diff options
344 files changed, 20 insertions, 38566 deletions
@@ -56,7 +56,6 @@ building for: - [Pango](https://download.gnome.org/sources/pango) - [Epoxy](https://github.com/anholt/libepoxy) - [Graphene](https://github.com/ebassi/graphene) - - [ATK](https://download.gnome.org/sources/atk) - [Xkb-common](https://github.com/xkbcommon/libxkbcommon) If you are building the X11 backend, you will also need: @@ -70,7 +69,6 @@ If you are building the X11 backend, you will also need: - xcursor - xdamage - xcomposite - - [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk) If you are building the Wayland backend, you will also need: diff --git a/demos/gtk-demo/demo.ui b/demos/gtk-demo/demo.ui index 7cb39a33e7..c93d6d46b5 100644 --- a/demos/gtk-demo/demo.ui +++ b/demos/gtk-demo/demo.ui @@ -95,9 +95,6 @@ <property name="program-name" translatable="yes">Builder demo</property> <property name="logo-icon-name" translatable="yes">gtk3-demo</property> <property name="modal">True</property> - <accessibility> - <relation target="window1" type="subwindow-of"/> - </accessibility> </object> <object class="GtkWindow" id="window1"> <property name="default-height">250</property> @@ -113,11 +110,6 @@ </child> <child> <object class="GtkBox" id="toolbar1"> - <child internal-child="accessible"> - <object class="AtkObject" id="a11y-toolbar"> - <property name="AtkObject::accessible-name">The toolbar</property> - </object> - </child> <child> <object class="GtkButton"> <property name="label" translatable="yes">New</property> @@ -174,14 +166,6 @@ <object class="GtkTreeView" id="treeview1"> <property name="model">liststore1</property> <property name="tooltip-column">3</property> - <child internal-child="accessible"> - <object class="AtkObject" id="a11y-treeview"> - <property name="AtkObject::accessible-name">Name list</property> - <property name="AtkObject::accessible-description"> - A list of person with name, surname and age columns - </property> - </object> - </child> <child> <object class="GtkTreeViewColumn" id="column1"> <property name="title">Name</property> diff --git a/demos/gtk-demo/demotaggedentry.c b/demos/gtk-demo/demotaggedentry.c index 63794cdf5f..922127dee4 100644 --- a/demos/gtk-demo/demotaggedentry.c +++ b/demos/gtk-demo/demotaggedentry.c @@ -23,7 +23,6 @@ #include "demotaggedentry.h" #include <gtk/gtk.h> -#include <gtk/gtk-a11y.h> struct _DemoTaggedEntry { @@ -119,7 +118,6 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass) gtk_editable_install_properties (object_class, 1); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, "entry"); } diff --git a/demos/gtk-demo/filtermodel.ui b/demos/gtk-demo/filtermodel.ui index a4dc98b34a..1d0762d93d 100644 --- a/demos/gtk-demo/filtermodel.ui +++ b/demos/gtk-demo/filtermodel.ui @@ -45,9 +45,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="treeview1"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">0</property> @@ -83,9 +80,6 @@ </child> </object> </child> - <accessibility> - <relation type="labelled-by" target="label1"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">1</property> @@ -133,9 +127,6 @@ </child> </object> </child> - <accessibility> - <relation type="labelled-by" target="label2"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="top-attach">1</property> @@ -149,9 +140,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="treeview2"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="top-attach">0</property> @@ -165,9 +153,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="treeview3"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">2</property> @@ -197,9 +182,6 @@ </child> </object> </child> - <accessibility> - <relation type="labelled-by" target="label3"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">3</property> diff --git a/demos/gtk-demo/listbox.ui b/demos/gtk-demo/listbox.ui index 6b63609362..feb9307b59 100644 --- a/demos/gtk-demo/listbox.ui +++ b/demos/gtk-demo/listbox.ui @@ -84,9 +84,6 @@ <property name="yalign">0</property> <property name="label" translatable="0">Message</property> <property name="wrap">1</property> - <accessibility> - <role type="static"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="top-attach">1</property> diff --git a/demos/gtk-demo/scale.ui b/demos/gtk-demo/scale.ui index 9859d17408..be6d0de3a0 100644 --- a/demos/gtk-demo/scale.ui +++ b/demos/gtk-demo/scale.ui @@ -33,9 +33,6 @@ <object class="GtkLabel" id="label_plain"> <property name="label">Plain</property> <property name="xalign">0</property> - <accessibility> - <relation type="label-for" target="scale_plain"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">0</property> @@ -48,9 +45,6 @@ <property name="draw-value">0</property> <property name="adjustment">adjustment1</property> <property name="hexpand">1</property> - <accessibility> - <relation type="labelled-by" target="label_plain"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="top-attach">0</property> @@ -61,9 +55,6 @@ <object class="GtkLabel" id="label_marks"> <property name="label">Marks</property> <property name="xalign">0</property> - <accessibility> - <relation type="label-for" target="scale_marks"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">1</property> @@ -83,9 +74,6 @@ <mark value="3" position="bottom"></mark> <mark value="4" position="bottom"></mark> </marks> - <accessibility> - <relation type="labelled-by" target="label_marks"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="top-attach">1</property> @@ -96,9 +84,6 @@ <object class="GtkLabel" id="label_discrete"> <property name="label">Discrete</property> <property name="xalign">0</property> - <accessibility> - <relation type="label-for" target="scale_discrete"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">2</property> @@ -112,9 +97,6 @@ <property name="draw-value">0</property> <property name="adjustment">adjustment3</property> <property name="hexpand">1</property> - <accessibility> - <relation type="labelled-by" target="label_discrete"/> - </accessibility> <marks> <mark value="0" position="bottom"></mark> <mark value="1" position="bottom"></mark> diff --git a/demos/icon-browser/window.ui b/demos/icon-browser/window.ui index ab76bb5bac..651db7b3e9 100644 --- a/demos/icon-browser/window.ui +++ b/demos/icon-browser/window.ui @@ -245,9 +245,6 @@ <object class="GtkImage" id="image1"> <property name="halign">center</property> <property name="valign">end</property> - <accessibility> - <relation type="labelled-by" target="label1"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">1</property> @@ -258,9 +255,6 @@ <object class="GtkImage" id="image2"> <property name="halign">center</property> <property name="valign">end</property> - <accessibility> - <relation type="labelled-by" target="label2"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="top-attach">1</property> @@ -271,9 +265,6 @@ <object class="GtkImage" id="image3"> <property name="halign">center</property> <property name="valign">end</property> - <accessibility> - <relation type="labelled-by" target="label3"/> - </accessibility> <layout> <property name="left-attach">2</property> <property name="top-attach">1</property> @@ -284,9 +275,6 @@ <object class="GtkImage" id="image4"> <property name="halign">center</property> <property name="valign">end</property> - <accessibility> - <relation type="labelled-by" target="label4"/> - </accessibility> <layout> <property name="left-attach">3</property> <property name="top-attach">1</property> @@ -297,9 +285,6 @@ <object class="GtkImage" id="image5"> <property name="halign">center</property> <property name="valign">end</property> - <accessibility> - <relation type="labelled-by" target="label5"/> - </accessibility> <layout> <property name="left-attach">4</property> <property name="top-attach">1</property> @@ -310,9 +295,6 @@ <object class="GtkImage" id="image6"> <property name="halign">center</property> <property name="valign">end</property> - <accessibility> - <relation type="labelled-by" target="label5"/> - </accessibility> <layout> <property name="left-attach">5</property> <property name="top-attach">1</property> @@ -323,9 +305,6 @@ <object class="GtkImage" id="image7"> <property name="halign">center</property> <property name="valign">end</property> - <accessibility> - <relation type="labelled-by" target="label5"/> - </accessibility> <layout> <property name="left-attach">6</property> <property name="top-attach">1</property> @@ -336,9 +315,6 @@ <object class="GtkImage" id="image8"> <property name="halign">center</property> <property name="valign">end</property> - <accessibility> - <relation type="labelled-by" target="label6"/> - </accessibility> <layout> <property name="left-attach">7</property> <property name="top-attach">1</property> @@ -353,9 +329,6 @@ <style> <class name="dim-label"/> </style> - <accessibility> - <relation type="label-for" target="image1"/> - </accessibility> <layout> <property name="left-attach">0</property> <property name="top-attach">2</property> @@ -370,9 +343,6 @@ <style> <class name="dim-label"/> </style> - <accessibility> - <relation type="label-for" target="image2"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="top-attach">2</property> @@ -387,9 +357,6 @@ <style> <class name="dim-label"/> </style> - <accessibility> - <relation type="label-for" target="image3"/> - </accessibility> <layout> <property name="left-attach">2</property> <property name="top-attach">2</property> @@ -404,9 +371,6 @@ <style> <class name="dim-label"/> </style> - <accessibility> - <relation type="label-for" target="image4"/> - </accessibility> <layout> <property name="left-attach">3</property> <property name="top-attach">2</property> @@ -421,9 +385,6 @@ <style> <class name="dim-label"/> </style> - <accessibility> - <relation type="label-for" target="image5"/> - </accessibility> <layout> <property name="left-attach">4</property> <property name="top-attach">2</property> @@ -438,9 +399,6 @@ <style> <class name="dim-label"/> </style> - <accessibility> - <relation type="label-for" target="image6"/> - </accessibility> <layout> <property name="left-attach">5</property> <property name="top-attach">2</property> @@ -455,9 +413,6 @@ <style> <class name="dim-label"/> </style> - <accessibility> - <relation type="label-for" target="image7"/> - </accessibility> <layout> <property name="left-attach">6</property> <property name="top-attach">2</property> @@ -472,9 +427,6 @@ <style> <class name="dim-label"/> </style> - <accessibility> - <relation type="label-for" target="image8"/> - </accessibility> <layout> <property name="left-attach">7</property> <property name="top-attach">2</property> diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c index 1ca731eb2c..885b81bd6d 100644 --- a/demos/widget-factory/widget-factory.c +++ b/demos/widget-factory/widget-factory.c @@ -565,7 +565,6 @@ on_scale_button_value_changed (GtkScaleButton *button, } gtk_widget_set_tooltip_text (GTK_WIDGET (button), str); - atk_object_set_description (gtk_widget_get_accessible (GTK_WIDGET (button)), str); g_free (str); } diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui index 0083826df7..e8e1db8052 100644 --- a/demos/widget-factory/widget-factory.ui +++ b/demos/widget-factory/widget-factory.ui @@ -3029,9 +3029,6 @@ bad things might happen.</property> <property name="margin-top">20</property> <property name="margin-bottom">20</property> <property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> @@ -3231,9 +3228,6 @@ bad things might happen.</property> <object class="GtkLabel" id="title_label"> <property name="label">Title:</property> <property name="xalign">1</property> - <accessibility> - <relation type="label-for" target="open_popover_entry"/> - </accessibility> </object> </child> <child> @@ -3241,9 +3235,6 @@ bad things might happen.</property> <property name="valign">start</property> <property name="label">Description:</property> <property name="xalign">1</property> - <accessibility> - <relation type="label-for" target="open_popover_textview"/> - </accessibility> <layout> <property name="top-attach">1</property> </layout> @@ -3259,9 +3250,6 @@ bad things might happen.</property> <property name="max-content-width">100</property> <child> <object class="GtkTextView" id="open_popover_textview"> - <accessibility> - <relation type="labelled-by" target="description_label"/> - </accessibility> </object> </child> <layout> @@ -3274,9 +3262,6 @@ bad things might happen.</property> <child> <object class="GtkEntry" id="open_popover_entry"> <property name="activates-default">1</property> - <accessibility> - <relation type="labelled-by" target="title_label"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="column-span">2</property> @@ -3357,9 +3342,6 @@ bad things might happen.</property> <child> <object class="GtkLabel"> <property name="label">No updates at this time</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> @@ -3368,9 +3350,6 @@ bad things might happen.</property> <child> <object class="GtkLabel"> <property name="label">You're in too deep!</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> diff --git a/docs/reference/gtk/building.md b/docs/reference/gtk/building.md index 1f676faae8..7412e25473 100644 --- a/docs/reference/gtk/building.md +++ b/docs/reference/gtk/building.md @@ -127,7 +127,7 @@ compilation flags needed for that library along with version number information.) Some of the libraries that GTK depends on are maintained by the -GTK team: GLib, GdkPixbuf, Pango, ATK and GObject Introspection. +GTK team: GLib, GdkPixbuf, Pango, and GObject Introspection. Other libraries are maintained separately. - The GLib library provides core non-graphical functionality @@ -139,10 +139,6 @@ Other libraries are maintained separately. file formats. It is available [here](ttps://download.gnome.org/sources/gdk-pixbuf/). - [Pango](http://www.pango.org) is a library for internationalized text handling. It is available [here](https://download.gnome.org/sources/pango/). -- ATK is the Accessibility Toolkit. It provides a set of generic - interfaces allowing accessibility technologies such as - screen readers to interact with a graphical user interface. - It is available [here](https://download.gnome.org/sources/atk/). - [GObject Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection) is a framework for making introspection data available to language bindings. It is available [here](https://download.gnome.org/sources/gobject-introspection/). @@ -192,7 +188,7 @@ you'll have all of these installed already, or they will be easily accessible through your operating system package repositories. Then build and install the GTK libraries in the order: -GLib, Cairo, Pango, ATK, then GTK. For each library, follow the +GLib, Cairo, Pango, then GTK. For each library, follow the instructions they provide, and make sure to share common settings between them and the GTK build; if you are using a separate prefix for GTK, for instance, you will need to use the same prefix for diff --git a/docs/reference/gtk/compiling.md b/docs/reference/gtk/compiling.md index 55e154bd17..1cceedded1 100644 --- a/docs/reference/gtk/compiling.md +++ b/docs/reference/gtk/compiling.md @@ -9,9 +9,9 @@ is used (the actual output on your system may be different): ``` $ pkg-config --cflags gtk4 - -pthread -I/usr/include/gtk-4.0 -I/usr/lib64/gtk-4.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 + -pthread -I/usr/include/gtk-4.0 -I/usr/lib64/gtk-4.0/include -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 $ pkg-config --libs gtk4 - -pthread -lgtk-4 -lgdk-4 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 + -pthread -lgtk-4 -lgdk-4 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 ``` The simplest way to compile a program is to use the "backticks" feature of the shell. If you enclose a command in backticks diff --git a/docs/reference/gtk/overview.xml b/docs/reference/gtk/overview.xml index f49ce93eb8..0435836586 100644 --- a/docs/reference/gtk/overview.xml +++ b/docs/reference/gtk/overview.xml @@ -62,18 +62,6 @@ other widgets that display text. </varlistentry> <varlistentry> -<term>ATK</term> -<listitem><para> -ATK is the Accessibility Toolkit. It provides a set of generic -interfaces allowing accessibility technologies to interact with a -graphical user interface. For example, a screen reader uses ATK to -discover the text in an interface and read it to blind users. GTK -widgets have built-in support for accessibility using the ATK -framework. -</para></listitem> -</varlistentry> - -<varlistentry> <term>GdkPixbuf</term> <listitem><para> This is a small library which allows you to create GdkPixbuf diff --git a/gtk/a11y/gtk-a11y-autocleanups.h b/gtk/a11y/gtk-a11y-autocleanups.h deleted file mode 100644 index 33be4124c0..0000000000 --- a/gtk/a11y/gtk-a11y-autocleanups.h +++ /dev/null @@ -1,67 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * 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 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/>. - */ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#ifndef __GI_SCANNER__ - -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBooleanCellAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkButtonAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellAccessibleParent, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBoxAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkContainerCellAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEntryAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkExpanderAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFlowBoxAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFlowBoxChildAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFrameAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkIconViewAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkImageAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkImageCellAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLabelAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLevelBarAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLinkButtonAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListBoxAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListBoxRowAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLockButtonAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMenuButtonAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkNotebookAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkNotebookPageAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPanedAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPopoverAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkProgressBarAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRadioButtonAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRangeAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRendererCellAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkScaleAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkScaleButtonAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkScrolledWindowAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSpinButtonAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSpinnerAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStatusbarAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSwitchAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextCellAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextViewAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToggleButtonAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToplevelAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeViewAccessible, g_object_unref) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWindowAccessible, g_object_unref) - -#endif diff --git a/gtk/a11y/gtkaccessibility.c b/gtk/a11y/gtkaccessibility.c deleted file mode 100644 index ad9d3b0e1c..0000000000 --- a/gtk/a11y/gtkaccessibility.c +++ /dev/null @@ -1,43 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkaccessibility.h" -#include "gtkaccessibilityutil.h" - -#ifdef GDK_WINDOWING_X11 -#include <atk-bridge.h> -#endif - -static int initialized = FALSE; - -void -_gtk_accessibility_init (void) -{ - if (initialized) - return; - - initialized = TRUE; - - _gtk_accessibility_override_atk_util (); - -#ifdef GDK_WINDOWING_X11 - atk_bridge_adaptor_init (NULL, NULL); -#endif - -} diff --git a/gtk/a11y/gtkaccessibility.h b/gtk/a11y/gtkaccessibility.h deleted file mode 100644 index 67401f8e96..0000000000 --- a/gtk/a11y/gtkaccessibility.h +++ /dev/null @@ -1,30 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#ifndef __GTK_ACCESSIBILITY_H__ -#define __GTK_ACCESSIBILITY_H__ - -#include <glib.h> -#include "gtk/gtkwidget.h" - -G_BEGIN_DECLS - -void _gtk_accessibility_init (void); - -G_END_DECLS - -#endif /* __GTK_ACCESSIBILITY_H__ */ diff --git a/gtk/a11y/gtkaccessibilityutil.c b/gtk/a11y/gtkaccessibilityutil.c deleted file mode 100644 index 78bef37c3b..0000000000 --- a/gtk/a11y/gtkaccessibilityutil.c +++ /dev/null @@ -1,109 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2011, F123 Consulting & Mais Diferenças - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <stdlib.h> -#include <gtk/gtk.h> -#include "gtkaccessibility.h" -#include "gtkaccessibilityutil.h" -#include "gtktoplevelaccessible.h" - -static GSList *key_listener_list = NULL; - -typedef struct { - AtkKeySnoopFunc func; - gpointer data; - guint key; -} KeyEventListener; - -static guint -add_key_event_listener (AtkKeySnoopFunc listener_func, - gpointer listener_data) -{ - static guint key = 0; - KeyEventListener *listener; - - key++; - - listener = g_slice_new0 (KeyEventListener); - listener->func = listener_func; - listener->data = listener_data; - listener->key = key; - - key_listener_list = g_slist_append (key_listener_list, listener); - - return key; -} - -static void -remove_key_event_listener (guint listener_key) -{ - GSList *l; - - for (l = key_listener_list; l; l = l->next) - { - KeyEventListener *listener = l->data; - - if (listener->key == listener_key) - { - g_slice_free (KeyEventListener, listener); - key_listener_list = g_slist_delete_link (key_listener_list, l); - - break; - } - } -} - -static AtkObject * -get_root (void) -{ - static AtkObject *root = NULL; - - if (!root) - { - root = g_object_new (GTK_TYPE_TOPLEVEL_ACCESSIBLE, NULL); - atk_object_initialize (root, NULL); - } - - return root; -} - -static const char * -get_toolkit_name (void) -{ - return "gtk"; -} - -static const char * -get_toolkit_version (void) -{ - return GTK_VERSION; -} - -void -_gtk_accessibility_override_atk_util (void) -{ - AtkUtilClass *atk_class = ATK_UTIL_CLASS (g_type_class_ref (ATK_TYPE_UTIL)); - - atk_class->add_key_event_listener = add_key_event_listener; - atk_class->remove_key_event_listener = remove_key_event_listener; - atk_class->get_root = get_root; - atk_class->get_toolkit_name = get_toolkit_name; - atk_class->get_toolkit_version = get_toolkit_version; -} diff --git a/gtk/a11y/gtkaccessibilityutil.h b/gtk/a11y/gtkaccessibilityutil.h deleted file mode 100644 index 7ab28c39ef..0000000000 --- a/gtk/a11y/gtkaccessibilityutil.h +++ /dev/null @@ -1,29 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_ACCESSIBILITY_UTIL_H__ -#define __GTK_ACCESSIBILITY_UTIL_H__ - -#include <atk/atk.h> - -G_BEGIN_DECLS - -void _gtk_accessibility_override_atk_util (void); - -G_END_DECLS - -#endif /* __GTK_ACCESSIBILITY_UTIL_H__ */ diff --git a/gtk/a11y/gtkbooleancellaccessible.c b/gtk/a11y/gtkbooleancellaccessible.c deleted file mode 100644 index 634bfd449d..0000000000 --- a/gtk/a11y/gtkbooleancellaccessible.c +++ /dev/null @@ -1,164 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include <glib/gi18n-lib.h> -#include "gtkbooleancellaccessible.h" - -struct _GtkBooleanCellAccessiblePrivate -{ - gboolean cell_value; - gboolean cell_sensitive; -}; - -static AtkActionIface *parent_action_iface; - -static int -gtk_boolean_cell_accessible_get_n_actions (AtkAction *action) -{ - return parent_action_iface->get_n_actions (action) + 1; -} - -static const char * -gtk_boolean_cell_accessible_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Toggles the cell"); - - return parent_action_iface->get_description (action, i - 1); -} - -static const char * -gtk_boolean_cell_accessible_action_get_name (AtkAction *action, - int i) -{ - if (i == 0) - return "toggle"; - - return parent_action_iface->get_description (action, i - 1); -} - -static const char * -gtk_boolean_cell_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Toggle"); - - return parent_action_iface->get_description (action, i - 1); -} - -static gboolean -gtk_boolean_cell_accessible_do_action (AtkAction *action, - int i) -{ - if (i == 0) - return parent_action_iface->do_action (action, 2); - - return parent_action_iface->do_action (action, i - 1); -} - -static void -gtk_boolean_cell_accessible_action_interface_init (AtkActionIface *iface) -{ - parent_action_iface = g_type_interface_peek_parent (iface); - - iface->do_action = gtk_boolean_cell_accessible_do_action; - iface->get_n_actions = gtk_boolean_cell_accessible_get_n_actions; - iface->get_description = gtk_boolean_cell_accessible_get_description; - iface->get_name = gtk_boolean_cell_accessible_action_get_name; - iface->get_localized_name = gtk_boolean_cell_accessible_action_get_localized_name; -} - - -G_DEFINE_TYPE_WITH_CODE (GtkBooleanCellAccessible, gtk_boolean_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE, - G_ADD_PRIVATE (GtkBooleanCellAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, gtk_boolean_cell_accessible_action_interface_init)) - - -static AtkStateSet * -gtk_boolean_cell_accessible_ref_state_set (AtkObject *accessible) -{ - GtkBooleanCellAccessible *cell = GTK_BOOLEAN_CELL_ACCESSIBLE (accessible); - AtkStateSet *state_set; - - state_set = ATK_OBJECT_CLASS (gtk_boolean_cell_accessible_parent_class)->ref_state_set (accessible); - - if (cell->priv->cell_value) - atk_state_set_add_state (state_set, ATK_STATE_CHECKED); - - if (cell->priv->cell_sensitive) - atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE); - else - atk_state_set_remove_state (state_set, ATK_STATE_SENSITIVE); - - return state_set; -} - -static void -gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell, - gboolean emit_signal) -{ - GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell); - gboolean active; - gboolean sensitive; - GtkCellRenderer *renderer; - - g_object_get (cell, "renderer", &renderer, NULL); - g_object_get (renderer, - "active", &active, - "sensitive", &sensitive, - NULL); - g_object_unref (renderer); - - if (boolean_cell->priv->cell_value != active) - { - boolean_cell->priv->cell_value = !boolean_cell->priv->cell_value; - - if (emit_signal) - atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, active); - } - - if (boolean_cell->priv->cell_sensitive != sensitive) - { - boolean_cell->priv->cell_sensitive = !boolean_cell->priv->cell_sensitive; - - if (emit_signal) - atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_SENSITIVE, sensitive); - } -} - -static void -gtk_boolean_cell_accessible_class_init (GtkBooleanCellAccessibleClass *klass) -{ - GtkCellAccessibleClass *cell_class = GTK_CELL_ACCESSIBLE_CLASS (klass); - AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass); - - atkobject_class->ref_state_set = gtk_boolean_cell_accessible_ref_state_set; - - cell_class->update_cache = gtk_boolean_cell_accessible_update_cache; -} - -static void -gtk_boolean_cell_accessible_init (GtkBooleanCellAccessible *cell) -{ - cell->priv = gtk_boolean_cell_accessible_get_instance_private (cell); -} - diff --git a/gtk/a11y/gtkbooleancellaccessible.h b/gtk/a11y/gtkbooleancellaccessible.h deleted file mode 100644 index ba344e6cfc..0000000000 --- a/gtk/a11y/gtkbooleancellaccessible.h +++ /dev/null @@ -1,58 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_BOOLEAN_CELL_ACCESSIBLE_H__ -#define __GTK_BOOLEAN_CELL_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <atk/atk.h> -#include <gtk/a11y/gtkrenderercellaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE (gtk_boolean_cell_accessible_get_type ()) -#define GTK_BOOLEAN_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, GtkBooleanCellAccessible)) -#define GTK_BOOLEAN_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_BOOLEAN_CELL, GtkBooleanCellAccessibleClass)) -#define GTK_IS_BOOLEAN_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE)) -#define GTK_IS_BOOLEAN_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE)) -#define GTK_BOOLEAN_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, GtkBooleanCellAccessibleClass)) - -typedef struct _GtkBooleanCellAccessible GtkBooleanCellAccessible; -typedef struct _GtkBooleanCellAccessibleClass GtkBooleanCellAccessibleClass; -typedef struct _GtkBooleanCellAccessiblePrivate GtkBooleanCellAccessiblePrivate; - -struct _GtkBooleanCellAccessible -{ - GtkRendererCellAccessible parent; - - GtkBooleanCellAccessiblePrivate *priv; -}; - -struct _GtkBooleanCellAccessibleClass -{ - GtkRendererCellAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_boolean_cell_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GAIL_TREE_VIEW_BOOLEAN_CELL_H__ */ diff --git a/gtk/a11y/gtkbuttonaccessible.c b/gtk/a11y/gtkbuttonaccessible.c deleted file mode 100644 index b01d5ceefb..0000000000 --- a/gtk/a11y/gtkbuttonaccessible.c +++ /dev/null @@ -1,436 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include <glib/gi18n-lib.h> -#include "gtkbuttonaccessible.h" - - -static void atk_action_interface_init (AtkActionIface *iface); -static void atk_image_interface_init (AtkImageIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkButtonAccessible, gtk_button_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init)) - -static void -gtk_button_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkWidget *parent; - - ATK_OBJECT_CLASS (gtk_button_accessible_parent_class)->initialize (obj, data); - - parent = gtk_widget_get_parent (gtk_accessible_get_widget (GTK_ACCESSIBLE (obj))); - if (GTK_IS_TREE_VIEW (parent)) - { - /* Even though the accessible parent of the column header will - * be reported as the table because the parent widget of the - * GtkTreeViewColumn's button is the GtkTreeView we set - * the accessible parent for column header to be the table - * to ensure that atk_object_get_index_in_parent() returns - * the correct value; see gail_widget_get_index_in_parent(). - */ - atk_object_set_parent (obj, gtk_widget_get_accessible (parent)); - obj->role = ATK_ROLE_TABLE_COLUMN_HEADER; - } - else - obj->role = ATK_ROLE_PUSH_BUTTON; -} - -static GtkWidget * -get_image_from_button (GtkWidget *button) -{ - GtkWidget *image; - - image = gtk_button_get_child (GTK_BUTTON (button)); - if (GTK_IS_IMAGE (image)) - return image; - - return NULL; -} - -static GtkWidget * -find_label_child (GtkWidget *widget) -{ - GtkWidget *child; - - for (child = gtk_widget_get_first_child (widget); - child != NULL; - child = gtk_widget_get_next_sibling (widget)) - { - if (GTK_IS_LABEL (child)) - return child; - else - { - GtkWidget *w = find_label_child (child); - if (w) - return w; - } - } - - return NULL; -} - -static GtkWidget * -get_label_from_button (GtkWidget *button) -{ - GtkWidget *child; - - child = gtk_button_get_child (GTK_BUTTON (button)); - - if (!GTK_IS_LABEL (child)) - child = find_label_child (child); - - return child; -} - -static const char * -gtk_button_accessible_get_name (AtkObject *obj) -{ - const char *name = NULL; - GtkWidget *widget; - GtkWidget *child; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - name = ATK_OBJECT_CLASS (gtk_button_accessible_parent_class)->get_name (obj); - if (name != NULL) - return name; - - child = get_label_from_button (widget); - if (GTK_IS_LABEL (child)) - name = gtk_label_get_text (GTK_LABEL (child)); - else - { - GtkWidget *image; - - image = get_image_from_button (widget); - if (GTK_IS_IMAGE (image)) - { - AtkObject *atk_obj; - - atk_obj = gtk_widget_get_accessible (image); - name = atk_object_get_name (atk_obj); - } - } - - return name; -} - -static int -gtk_button_accessible_get_n_children (AtkObject* obj) -{ - return 0; -} - -static AtkObject * -gtk_button_accessible_ref_child (AtkObject *obj, - int i) -{ - return NULL; -} - -static AtkStateSet * -gtk_button_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - state_set = ATK_OBJECT_CLASS (gtk_button_accessible_parent_class)->ref_state_set (obj); - - if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_ACTIVE) != 0) - atk_state_set_add_state (state_set, ATK_STATE_ARMED); - - if (!gtk_widget_get_can_focus (widget)) - atk_state_set_remove_state (state_set, ATK_STATE_SELECTABLE); - - return state_set; -} - -void -gtk_button_accessible_update_label (GtkButtonAccessible *self) -{ - g_return_if_fail (GTK_IS_BUTTON_ACCESSIBLE (self)); - - /* If we don't have an overridden name, we use the label as the - * accessible name - */ - if (atk_object_get_name (ATK_OBJECT (self)) == NULL) - g_object_notify (G_OBJECT (self), "accessible-name"); - - g_signal_emit_by_name (self, "visible-data-changed"); -} - -static void -gtk_button_accessible_class_init (GtkButtonAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_name = gtk_button_accessible_get_name; - class->get_n_children = gtk_button_accessible_get_n_children; - class->ref_child = gtk_button_accessible_ref_child; - class->ref_state_set = gtk_button_accessible_ref_state_set; - class->initialize = gtk_button_accessible_initialize; -} - -static void -gtk_button_accessible_init (GtkButtonAccessible *button) -{ -} - -static gboolean -gtk_button_accessible_do_action (AtkAction *action, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (i != 0) - return FALSE; - - if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - g_signal_emit_by_name (widget, "clicked"); - return TRUE; -} - -static int -gtk_button_accessible_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_button_accessible_get_keybinding (AtkAction *action, - int i) -{ - char *return_value = NULL; - GtkWidget *widget; - GtkWidget *label; - guint key_val; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return NULL; - - if (i != 0) - return NULL; - - label = get_label_from_button (widget); - if (GTK_IS_LABEL (label)) - { - key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); - if (key_val != GDK_KEY_VoidSymbol) - return_value = gtk_accelerator_name (key_val, GDK_ALT_MASK); - } - if (return_value == NULL) - { - /* Find labelled-by relation */ - AtkRelationSet *set; - AtkRelation *relation; - GPtrArray *target; - gpointer target_object; - - set = atk_object_ref_relation_set (ATK_OBJECT (action)); - if (set) - { - relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY); - if (relation) - { - target = atk_relation_get_target (relation); - target_object = g_ptr_array_index (target, 0); - label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object)); - } - g_object_unref (set); - } - - if (GTK_IS_LABEL (label)) - { - key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); - if (key_val != GDK_KEY_VoidSymbol) - return_value = gtk_accelerator_name (key_val, GDK_ALT_MASK); - } - } - return return_value; -} - -static const char * -gtk_button_accessible_action_get_name (AtkAction *action, - int i) -{ - if (i == 0) - return "click"; - return NULL; -} - -static const char * -gtk_button_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Click"); - return NULL; -} - -static const char * -gtk_button_accessible_action_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Clicks the button"); - return NULL; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_button_accessible_do_action; - iface->get_n_actions = gtk_button_accessible_get_n_actions; - iface->get_keybinding = gtk_button_accessible_get_keybinding; - iface->get_name = gtk_button_accessible_action_get_name; - iface->get_localized_name = gtk_button_accessible_action_get_localized_name; - iface->get_description = gtk_button_accessible_action_get_description; -} - -static const char * -gtk_button_accessible_get_image_description (AtkImage *image) -{ - GtkWidget *widget; - GtkWidget *button_image; - AtkObject *obj; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); - if (widget == NULL) - return NULL; - - button_image = get_image_from_button (widget); - if (GTK_IS_IMAGE (button_image)) - { - obj = gtk_widget_get_accessible (button_image); - return atk_image_get_image_description (ATK_IMAGE (obj)); - } - - return NULL; -} - -static void -gtk_button_accessible_get_image_position (AtkImage *image, - int *x, - int *y, - AtkCoordType coord_type) -{ - GtkWidget *widget; - GtkWidget *button_image; - AtkObject *obj; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); - if (widget == NULL) - { - *x = G_MININT; - *y = G_MININT; - return; - } - - button_image = get_image_from_button (widget); - if (button_image != NULL) - { - obj = gtk_widget_get_accessible (button_image); - atk_component_get_extents (ATK_COMPONENT (obj), x, y, NULL, NULL, - coord_type); - } - else - { - *x = G_MININT; - *y = G_MININT; - } -} - -static void -gtk_button_accessible_get_image_size (AtkImage *image, - int *width, - int *height) -{ - GtkWidget *widget; - GtkWidget *button_image; - AtkObject *obj; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); - if (widget == NULL) - { - *width = -1; - *height = -1; - return; - } - - button_image = get_image_from_button (widget); - if (GTK_IS_IMAGE (button_image)) - { - obj = gtk_widget_get_accessible (GTK_WIDGET (button_image)); - atk_image_get_image_size (ATK_IMAGE (obj), width, height); - } - else - { - *width = -1; - *height = -1; - } -} - -static gboolean -gtk_button_accessible_set_image_description (AtkImage *image, - const char *description) -{ - GtkWidget *widget; - GtkWidget *button_image; - AtkObject *obj; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); - - if (widget == NULL) - return FALSE; - - button_image = get_image_from_button (widget); - if (GTK_IMAGE (button_image)) - { - obj = gtk_widget_get_accessible (GTK_WIDGET (button_image)); - return atk_image_set_image_description (ATK_IMAGE (obj), description); - } - - return FALSE; -} - -static void -atk_image_interface_init (AtkImageIface *iface) -{ - iface->get_image_description = gtk_button_accessible_get_image_description; - iface->get_image_position = gtk_button_accessible_get_image_position; - iface->get_image_size = gtk_button_accessible_get_image_size; - iface->set_image_description = gtk_button_accessible_set_image_description; -} diff --git a/gtk/a11y/gtkbuttonaccessible.h b/gtk/a11y/gtkbuttonaccessible.h deleted file mode 100644 index 1c49c329b6..0000000000 --- a/gtk/a11y/gtkbuttonaccessible.h +++ /dev/null @@ -1,60 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_BUTTON_ACCESSIBLE_H__ -#define __GTK_BUTTON_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_BUTTON_ACCESSIBLE (gtk_button_accessible_get_type ()) -#define GTK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BUTTON_ACCESSIBLE, GtkButtonAccessible)) -#define GTK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_BUTTON_ACCESSIBLE, GtkButtonAccessibleClass)) -#define GTK_IS_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BUTTON_ACCESSIBLE)) -#define GTK_IS_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BUTTON_ACCESSIBLE)) -#define GTK_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BUTTON_ACCESSIBLE, GtkButtonAccessibleClass)) - -typedef struct _GtkButtonAccessible GtkButtonAccessible; -typedef struct _GtkButtonAccessibleClass GtkButtonAccessibleClass; -typedef struct _GtkButtonAccessiblePrivate GtkButtonAccessiblePrivate; - -struct _GtkButtonAccessible -{ - GtkWidgetAccessible parent; - - GtkButtonAccessiblePrivate *priv; -}; - -struct _GtkButtonAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_button_accessible_get_type (void); - -/*< private >*/ -void gtk_button_accessible_update_label (GtkButtonAccessible *self); - -G_END_DECLS - -#endif /* __GTK_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c deleted file mode 100644 index 71ef303ea3..0000000000 --- a/gtk/a11y/gtkcellaccessible.c +++ /dev/null @@ -1,533 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <glib/gi18n-lib.h> -#include <gtk/gtk.h> -#include "gtkcontainercellaccessible.h" -#include "gtkcellaccessibleprivate.h" -#include "gtkcellaccessibleparent.h" - -struct _GtkCellAccessiblePrivate -{ - AtkObject *parent; -}; - -static const struct { - AtkState atk_state; - GtkCellRendererState renderer_state; - gboolean invert; -} state_map[] = { - { ATK_STATE_SENSITIVE, GTK_CELL_RENDERER_INSENSITIVE, TRUE }, - { ATK_STATE_ENABLED, GTK_CELL_RENDERER_INSENSITIVE, TRUE }, - { ATK_STATE_SELECTED, GTK_CELL_RENDERER_SELECTED, FALSE }, - /* XXX: why do we map ACTIVE here? */ - { ATK_STATE_ACTIVE, GTK_CELL_RENDERER_FOCUSED, FALSE }, - { ATK_STATE_FOCUSED, GTK_CELL_RENDERER_FOCUSED, FALSE }, - { ATK_STATE_EXPANDABLE,GTK_CELL_RENDERER_EXPANDABLE, FALSE }, - { ATK_STATE_EXPANDED, GTK_CELL_RENDERER_EXPANDED, FALSE }, -}; - -static GtkCellRendererState gtk_cell_accessible_get_state (GtkCellAccessible *cell); -static void atk_action_interface_init (AtkActionIface *iface); -static void atk_component_interface_init (AtkComponentIface *iface); -static void atk_table_cell_interface_init (AtkTableCellIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkCellAccessible, gtk_cell_accessible, GTK_TYPE_ACCESSIBLE, - G_ADD_PRIVATE (GtkCellAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE_CELL, atk_table_cell_interface_init)) - -static int -gtk_cell_accessible_get_index_in_parent (AtkObject *obj) -{ - GtkCellAccessible *cell; - AtkObject *parent; - - cell = GTK_CELL_ACCESSIBLE (obj); - - if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)) - return g_list_index (gtk_container_cell_accessible_get_children (GTK_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)), obj); - - parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); - if (parent == NULL) - return -1; - - return gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (cell->priv->parent), cell); -} - -static AtkRelationSet * -gtk_cell_accessible_ref_relation_set (AtkObject *object) -{ - GtkCellAccessible *cell; - AtkRelationSet *relationset; - AtkObject *parent; - - relationset = ATK_OBJECT_CLASS (gtk_cell_accessible_parent_class)->ref_relation_set (object); - if (relationset == NULL) - relationset = atk_relation_set_new (); - - cell = GTK_CELL_ACCESSIBLE (object); - parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); - - gtk_cell_accessible_parent_update_relationset (GTK_CELL_ACCESSIBLE_PARENT (parent), - cell, - relationset); - - return relationset; -} - -static AtkStateSet * -gtk_cell_accessible_ref_state_set (AtkObject *accessible) -{ - GtkCellAccessible *cell_accessible; - AtkStateSet *state_set; - GtkCellRendererState flags; - guint i; - - cell_accessible = GTK_CELL_ACCESSIBLE (accessible); - - state_set = atk_state_set_new (); - - if (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell_accessible)) == NULL) - { - atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT); - return state_set; - } - - flags = gtk_cell_accessible_get_state (cell_accessible); - - atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); - atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE); - atk_state_set_add_state (state_set, ATK_STATE_TRANSIENT); - atk_state_set_add_state (state_set, ATK_STATE_VISIBLE); - - for (i = 0; i < G_N_ELEMENTS (state_map); i++) - { - if (flags & state_map[i].renderer_state) - { - if (!state_map[i].invert) - atk_state_set_add_state (state_set, state_map[i].atk_state); - } - else - { - if (state_map[i].invert) - atk_state_set_add_state (state_set, state_map[i].atk_state); - } - } - - if (gtk_widget_get_mapped (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell_accessible)))) - atk_state_set_add_state (state_set, ATK_STATE_SHOWING); - - return state_set; -} - -static AtkObject * -gtk_cell_accessible_get_parent (AtkObject *object) -{ - GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (object); - - return cell->priv->parent; -} - -static void -gtk_cell_accessible_class_init (GtkCellAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_index_in_parent = gtk_cell_accessible_get_index_in_parent; - class->ref_state_set = gtk_cell_accessible_ref_state_set; - class->ref_relation_set = gtk_cell_accessible_ref_relation_set; - class->get_parent = gtk_cell_accessible_get_parent; -} - -static void -gtk_cell_accessible_init (GtkCellAccessible *cell) -{ - cell->priv = gtk_cell_accessible_get_instance_private (cell); -} - -void -_gtk_cell_accessible_initialize (GtkCellAccessible *cell, - GtkWidget *widget, - AtkObject *parent) -{ - gtk_accessible_set_widget (GTK_ACCESSIBLE (cell), widget); - cell->priv->parent = parent; -} - -gboolean -_gtk_cell_accessible_add_state (GtkCellAccessible *cell, - AtkStateType state_type, - gboolean emit_signal) -{ - /* The signal should only be generated if the value changed, - * not when the cell is set up. So states that are set - * initially should pass FALSE as the emit_signal argument. - */ - if (emit_signal) - { - atk_object_notify_state_change (ATK_OBJECT (cell), state_type, TRUE); - /* If state_type is ATK_STATE_VISIBLE, additional notification */ - if (state_type == ATK_STATE_VISIBLE) - g_signal_emit_by_name (cell, "visible-data-changed"); - } - - /* If the parent is a flyweight container cell, propagate the state - * change to it also - */ - if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)) - _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell->priv->parent), state_type, emit_signal); - - return TRUE; -} - -gboolean -_gtk_cell_accessible_remove_state (GtkCellAccessible *cell, - AtkStateType state_type, - gboolean emit_signal) -{ - /* The signal should only be generated if the value changed, - * not when the cell is set up. So states that are set - * initially should pass FALSE as the emit_signal argument. - */ - if (emit_signal) - { - atk_object_notify_state_change (ATK_OBJECT (cell), state_type, FALSE); - /* If state_type is ATK_STATE_VISIBLE, additional notification */ - if (state_type == ATK_STATE_VISIBLE) - g_signal_emit_by_name (cell, "visible-data-changed"); - } - - /* If the parent is a flyweight container cell, propagate the state - * change to it also - */ - if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)) - _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell->priv->parent), state_type, emit_signal); - - return TRUE; -} - -static int -gtk_cell_accessible_action_get_n_actions (AtkAction *action) -{ - return 3; -} - -static const char * -gtk_cell_accessible_action_get_name (AtkAction *action, - int index) -{ - switch (index) - { - case 0: - return "expand or contract"; - case 1: - return "edit"; - case 2: - return "activate"; - default: - return NULL; - } -} - -static const char * -gtk_cell_accessible_action_get_localized_name (AtkAction *action, - int index) -{ - switch (index) - { - case 0: - return C_("Action name", "Expand or contract"); - case 1: - return C_("Action name", "Edit"); - case 2: - return C_("Action name", "Activate"); - default: - return NULL; - } -} - -static const char * -gtk_cell_accessible_action_get_description (AtkAction *action, - int index) -{ - switch (index) - { - case 0: - return C_("Action description", "Expands or contracts the row in the tree view containing this cell"); - case 1: - return C_("Action description", "Creates a widget in which the contents of the cell can be edited"); - case 2: - return C_("Action description", "Activates the cell"); - default: - return NULL; - } -} - -static const char * -gtk_cell_accessible_action_get_keybinding (AtkAction *action, - int index) -{ - return NULL; -} - -static gboolean -gtk_cell_accessible_action_do_action (AtkAction *action, - int index) -{ - GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (action); - GtkCellAccessibleParent *parent; - - if (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)) == NULL) - return FALSE; - - parent = GTK_CELL_ACCESSIBLE_PARENT (gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)))); - - switch (index) - { - case 0: - gtk_cell_accessible_parent_expand_collapse (parent, cell); - break; - case 1: - gtk_cell_accessible_parent_edit (parent, cell); - break; - case 2: - gtk_cell_accessible_parent_activate (parent, cell); - break; - default: - return FALSE; - } - - return TRUE; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->get_n_actions = gtk_cell_accessible_action_get_n_actions; - iface->do_action = gtk_cell_accessible_action_do_action; - iface->get_name = gtk_cell_accessible_action_get_name; - iface->get_localized_name = gtk_cell_accessible_action_get_localized_name; - iface->get_description = gtk_cell_accessible_action_get_description; - iface->get_keybinding = gtk_cell_accessible_action_get_keybinding; -} - -static void -gtk_cell_accessible_get_extents (AtkComponent *component, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkCellAccessible *cell; - AtkObject *parent; - - cell = GTK_CELL_ACCESSIBLE (component); - parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); - - gtk_cell_accessible_parent_get_cell_extents (GTK_CELL_ACCESSIBLE_PARENT (parent), - cell, - x, y, width, height, coord_type); -} - -static gboolean -gtk_cell_accessible_grab_focus (AtkComponent *component) -{ - GtkCellAccessible *cell; - AtkObject *parent; - - cell = GTK_CELL_ACCESSIBLE (component); - parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); - - return gtk_cell_accessible_parent_grab_focus (GTK_CELL_ACCESSIBLE_PARENT (parent), cell); -} - -static void -atk_component_interface_init (AtkComponentIface *iface) -{ - iface->get_extents = gtk_cell_accessible_get_extents; - iface->grab_focus = gtk_cell_accessible_grab_focus; -} - -static int -gtk_cell_accessible_get_column_span (AtkTableCell *table_cell) -{ - return 1; -} - -static GPtrArray * -gtk_cell_accessible_get_column_header_cells (AtkTableCell *table_cell) -{ - GtkCellAccessible *cell; - AtkObject *parent; - - cell = GTK_CELL_ACCESSIBLE (table_cell); - parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); - - return gtk_cell_accessible_parent_get_column_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent), - cell); -} - -static gboolean -gtk_cell_accessible_get_position (AtkTableCell *table_cell, - int *row, - int *column) -{ - GtkCellAccessible *cell; - AtkObject *parent; - - cell = GTK_CELL_ACCESSIBLE (table_cell); - parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); - - gtk_cell_accessible_parent_get_cell_position (GTK_CELL_ACCESSIBLE_PARENT (parent), - cell, - row, column); - return ((row && *row > 0) || (column && *column > 0)); -} - -static int -gtk_cell_accessible_get_row_span (AtkTableCell *table_cell) -{ - return 1; -} - -static GPtrArray * -gtk_cell_accessible_get_row_header_cells (AtkTableCell *table_cell) -{ - GtkCellAccessible *cell; - AtkObject *parent; - - cell = GTK_CELL_ACCESSIBLE (table_cell); - parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); - - return gtk_cell_accessible_parent_get_row_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent), - cell); -} - -static AtkObject * -gtk_cell_accessible_get_table (AtkTableCell *table_cell) -{ - AtkObject *obj; - - obj = ATK_OBJECT (table_cell); - do - { - AtkRole role; - obj = atk_object_get_parent (obj); - role = atk_object_get_role (obj); - if (role == ATK_ROLE_TABLE || role == ATK_ROLE_TREE_TABLE) - break; - } - while (obj); - return obj; -} - -static void -atk_table_cell_interface_init (AtkTableCellIface *iface) -{ - iface->get_column_span = gtk_cell_accessible_get_column_span; - iface->get_column_header_cells = gtk_cell_accessible_get_column_header_cells; - iface->get_position = gtk_cell_accessible_get_position; - iface->get_row_span = gtk_cell_accessible_get_row_span; - iface->get_row_header_cells = gtk_cell_accessible_get_row_header_cells; - iface->get_table = gtk_cell_accessible_get_table; -} - -static GtkCellRendererState -gtk_cell_accessible_get_state (GtkCellAccessible *cell) -{ - AtkObject *parent; - - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0); - - parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); - if (parent == NULL) - return 0; - - return gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent), cell); -} - -/* - * gtk_cell_accessible_state_changed: - * @cell: a #GtkCellAccessible - * @added: the flags that were added from @cell - * @removed: the flags that were removed from @cell - * - * Notifies @cell of state changes. Multiple states may be added - * or removed at the same time. A state that is @added may not be - * @removed at the same time. - **/ -void -_gtk_cell_accessible_state_changed (GtkCellAccessible *cell, - GtkCellRendererState added, - GtkCellRendererState removed) -{ - AtkObject *object; - guint i; - - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); - g_return_if_fail ((added & removed) == 0); - - object = ATK_OBJECT (cell); - - for (i = 0; i < G_N_ELEMENTS (state_map); i++) - { - if (added & state_map[i].renderer_state) - atk_object_notify_state_change (object, - state_map[i].atk_state, - !state_map[i].invert); - if (removed & state_map[i].renderer_state) - atk_object_notify_state_change (object, - state_map[i].atk_state, - state_map[i].invert); - } -} - -/* - * gtk_cell_accessible_update_cache: - * @cell: the cell that is changed - * @emit_signal: whether or not to notify the ATK bridge - * - * Notifies the cell that the values in the data in the row that - * is used to feed the cell renderer with has changed. The - * cell_changed function of @cell is called to send update - * notifications for the properties it takes from its cell - * renderer. If @emit_signal is TRUE, also notify the ATK bridge - * of the change. The bridge should be notified when an existing - * cell changes; not when a newly-created cell is being set up. - * - * Note that there is no higher granularity available about which - * properties changed, so you will need to make do with this - * function. - **/ -void -_gtk_cell_accessible_update_cache (GtkCellAccessible *cell, - gboolean emit_signal) -{ - GtkCellAccessibleClass *klass; - - g_return_if_fail (GTK_CELL_ACCESSIBLE (cell)); - - klass = GTK_CELL_ACCESSIBLE_GET_CLASS (cell); - - if (klass->update_cache) - klass->update_cache (cell, emit_signal); -} diff --git a/gtk/a11y/gtkcellaccessible.h b/gtk/a11y/gtkcellaccessible.h deleted file mode 100644 index e144eed0ad..0000000000 --- a/gtk/a11y/gtkcellaccessible.h +++ /dev/null @@ -1,60 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_CELL_ACCESSIBLE_H__ -#define __GTK_CELL_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <atk/atk.h> -#include <gtk/gtkaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_CELL_ACCESSIBLE (gtk_cell_accessible_get_type ()) -#define GTK_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessible)) -#define GTK_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessibleClass)) -#define GTK_IS_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_ACCESSIBLE)) -#define GTK_IS_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_ACCESSIBLE)) -#define GTK_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessibleClass)) - -typedef struct _GtkCellAccessible GtkCellAccessible; -typedef struct _GtkCellAccessibleClass GtkCellAccessibleClass; -typedef struct _GtkCellAccessiblePrivate GtkCellAccessiblePrivate; - -struct _GtkCellAccessible -{ - GtkAccessible parent; - - GtkCellAccessiblePrivate *priv; -}; - -struct _GtkCellAccessibleClass -{ - GtkAccessibleClass parent_class; - void (*update_cache) (GtkCellAccessible *cell, - gboolean emit_signal); -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_cell_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_CELL_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkcellaccessibleparent.c b/gtk/a11y/gtkcellaccessibleparent.c deleted file mode 100644 index f0389fc486..0000000000 --- a/gtk/a11y/gtkcellaccessibleparent.c +++ /dev/null @@ -1,271 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtkcellaccessibleparent.h" - -GType -gtk_cell_accessible_parent_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - - if (g_once_init_enter (&g_define_type_id__volatile)) - { - GType g_define_type_id = - g_type_register_static_simple (G_TYPE_INTERFACE, - g_intern_static_string ("GtkCellAccessibleParent"), - sizeof (GtkCellAccessibleParentIface), - NULL, - 0, - NULL, - 0); - - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); - } - - return g_define_type_id__volatile; -} - -/** - * gtk_cell_accessible_parent_get_cell_extents: - * @x: (out): - * @y: (out): - * @width: (out): - * @height: (out): - */ -void -gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkCellAccessibleParentIface *iface; - - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->get_cell_extents) - (iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type); -} - -/** - * gtk_cell_accessible_parent_get_cell_area: - * @cell_rect: (out): - */ -void -gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - GdkRectangle *cell_rect) -{ - GtkCellAccessibleParentIface *iface; - - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); - g_return_if_fail (cell_rect); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->get_cell_area) - (iface->get_cell_area) (parent, cell, cell_rect); -} - -gboolean -gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkCellAccessibleParentIface *iface; - - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->grab_focus) - return (iface->grab_focus) (parent, cell); - else - return FALSE; -} - -int -gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkCellAccessibleParentIface *iface; - - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->get_child_index) - return (iface->get_child_index) (parent, cell); - else - return -1; -} - -GtkCellRendererState -gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkCellAccessibleParentIface *iface; - - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), 0); - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->get_renderer_state) - return (iface->get_renderer_state) (parent, cell); - else - return 0; -} - -void -gtk_cell_accessible_parent_expand_collapse (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkCellAccessibleParentIface *iface; - - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->expand_collapse) - (iface->expand_collapse) (parent, cell); -} - -void -gtk_cell_accessible_parent_activate (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkCellAccessibleParentIface *iface; - - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->activate) - (iface->activate) (parent, cell); -} - -void -gtk_cell_accessible_parent_edit (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkCellAccessibleParentIface *iface; - - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->edit) - (iface->edit) (parent, cell); -} - -void -gtk_cell_accessible_parent_update_relationset (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - AtkRelationSet *relationset) -{ - GtkCellAccessibleParentIface *iface; - - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); - g_return_if_fail (ATK_IS_RELATION_SET (relationset)); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->update_relationset) - (iface->update_relationset) (parent, cell, relationset); -} - -/** - * gtk_cell_accessible_parent_get_cell_position: - * @row: (out): - * @column: (out): - */ -void -gtk_cell_accessible_parent_get_cell_position (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - int *row, - int *column) -{ - GtkCellAccessibleParentIface *iface; - - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->get_cell_position) - (iface->get_cell_position) (parent, cell, row, column); - else - { - if (row) - *row = -1; - if (column) - *column = -1; - } -} - -/** - * gtk_cell_accessible_parent_get_column_header_cells: - * Returns: (transfer full) (element-type AtkObject) - */ -GPtrArray * -gtk_cell_accessible_parent_get_column_header_cells (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkCellAccessibleParentIface *iface; - - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), NULL); - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), NULL); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->get_column_header_cells) - return (iface->get_column_header_cells) (parent, cell); - else - return NULL; -} - -/** - * gtk_cell_accessible_parent_get_row_header_cells: - * Returns: (transfer full) (element-type AtkObject) - */ -GPtrArray * -gtk_cell_accessible_parent_get_row_header_cells (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkCellAccessibleParentIface *iface; - - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), NULL); - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), NULL); - - iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent); - - if (iface->get_row_header_cells) - return (iface->get_row_header_cells) (parent, cell); - else - return NULL; -} diff --git a/gtk/a11y/gtkcellaccessibleparent.h b/gtk/a11y/gtkcellaccessibleparent.h deleted file mode 100644 index b724f71188..0000000000 --- a/gtk/a11y/gtkcellaccessibleparent.h +++ /dev/null @@ -1,140 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_CELL_ACCESSIBLE_PARENT_H__ -#define __GTK_CELL_ACCESSIBLE_PARENT_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <atk/atk.h> -#include <gtk/a11y/gtkcellaccessible.h> - -G_BEGIN_DECLS - -/* - * The GtkCellAccessibleParent interface should be supported by any object - * which contains children which are flyweights, i.e. do not have corresponding - * widgets and the children need help from their parent to provide - * functionality. One example is GtkTreeViewAccessible where the children - * GtkCellAccessible need help from the GtkTreeViewAccessible in order to - * implement atk_component_get_extents(). - */ - -#define GTK_TYPE_CELL_ACCESSIBLE_PARENT (gtk_cell_accessible_parent_get_type ()) -#define GTK_IS_CELL_ACCESSIBLE_PARENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT) -#define GTK_CELL_ACCESSIBLE_PARENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT, GtkCellAccessibleParent) -#define GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT, GtkCellAccessibleParentIface)) - -typedef struct _GtkCellAccessibleParent GtkCellAccessibleParent; -typedef struct _GtkCellAccessibleParentIface GtkCellAccessibleParentIface; - -struct _GtkCellAccessibleParentIface -{ - GTypeInterface parent; - void ( *get_cell_extents) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type); - void ( *get_cell_area) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - GdkRectangle *cell_rect); - gboolean ( *grab_focus) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); - int ( *get_child_index) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); - GtkCellRendererState - ( *get_renderer_state) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); - /* actions */ - void ( *expand_collapse) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); - void ( *activate) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); - void ( *edit) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); - /* end of actions */ - void ( *update_relationset) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - AtkRelationSet *relationset); - void ( *get_cell_position) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - int *row, - int *column); - GPtrArray * ( *get_column_header_cells) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); - GPtrArray * ( *get_row_header_cells) (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_cell_accessible_parent_get_type (void); - -GDK_AVAILABLE_IN_ALL -void gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type); -GDK_AVAILABLE_IN_ALL -void gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - GdkRectangle *cell_rect); -GDK_AVAILABLE_IN_ALL -gboolean gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); -GDK_AVAILABLE_IN_ALL -int gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); -GDK_AVAILABLE_IN_ALL -GtkCellRendererState - gtk_cell_accessible_parent_get_renderer_state(GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); -GDK_AVAILABLE_IN_ALL -void gtk_cell_accessible_parent_expand_collapse (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); -GDK_AVAILABLE_IN_ALL -void gtk_cell_accessible_parent_activate (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); -GDK_AVAILABLE_IN_ALL -void gtk_cell_accessible_parent_edit (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); -GDK_AVAILABLE_IN_ALL -void gtk_cell_accessible_parent_update_relationset (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - AtkRelationSet *relationset); -GDK_AVAILABLE_IN_ALL -void gtk_cell_accessible_parent_get_cell_position(GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - int *row, - int *column); -GDK_AVAILABLE_IN_ALL -GPtrArray *gtk_cell_accessible_parent_get_column_header_cells (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); -GDK_AVAILABLE_IN_ALL -GPtrArray *gtk_cell_accessible_parent_get_row_header_cells (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell); - -G_END_DECLS - -#endif /* __GTK_CELL_ACCESSIBLE_PARENT_H__ */ diff --git a/gtk/a11y/gtkcellaccessibleprivate.h b/gtk/a11y/gtkcellaccessibleprivate.h deleted file mode 100644 index 80fb1435c9..0000000000 --- a/gtk/a11y/gtkcellaccessibleprivate.h +++ /dev/null @@ -1,42 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_CELL_ACCESSIBLE_PRIVATE_H__ -#define __GTK_CELL_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtkcellaccessible.h> - -G_BEGIN_DECLS - -void _gtk_cell_accessible_state_changed (GtkCellAccessible *cell, - GtkCellRendererState added, - GtkCellRendererState removed); -void _gtk_cell_accessible_update_cache (GtkCellAccessible *cell, - gboolean emit_signal); -void _gtk_cell_accessible_initialize (GtkCellAccessible *cell, - GtkWidget *widget, - AtkObject *parent); -gboolean _gtk_cell_accessible_add_state (GtkCellAccessible *cell, - AtkStateType state_type, - gboolean emit_signal); -gboolean _gtk_cell_accessible_remove_state (GtkCellAccessible *cell, - AtkStateType state_type, - gboolean emit_signal); - -G_END_DECLS - -#endif /* __GTK_CELL_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtkcolorswatchaccessible.c b/gtk/a11y/gtkcolorswatchaccessible.c deleted file mode 100644 index 8ea77a6590..0000000000 --- a/gtk/a11y/gtkcolorswatchaccessible.c +++ /dev/null @@ -1,211 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2012 Red Hat, Inc - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkcolorswatchaccessibleprivate.h" -#include "gtkcolorswatchprivate.h" - -#include <glib/gi18n-lib.h> - -static void atk_action_interface_init (AtkActionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkColorSwatchAccessible, _gtk_color_swatch_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - -static void -state_changed_cb (GtkWidget *widget, - GtkStateFlags previous_flags, - AtkObject *accessible) -{ - GtkStateFlags flags; - gboolean was_selected; - gboolean selected; - - flags = gtk_widget_get_state_flags (widget); - - was_selected = (previous_flags & GTK_STATE_FLAG_SELECTED) != 0; - selected = (flags & GTK_STATE_FLAG_SELECTED) != 0; - - if (selected && !was_selected) - atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, TRUE); - else if (!selected && was_selected) - atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, FALSE); -} - -static void -on_selectable_changed_cb (GObject *gobject, - GParamSpec *pspec, - AtkObject *accessible) -{ - GtkColorSwatch *swatch = GTK_COLOR_SWATCH (gobject); - AtkRole role; - - if (gtk_color_swatch_get_selectable (swatch)) - role = ATK_ROLE_RADIO_BUTTON; - else - role = ATK_ROLE_PUSH_BUTTON; - - atk_object_set_role (accessible, role); -} - -static void -gtk_color_swatch_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkColorSwatch *swatch = data; - - ATK_OBJECT_CLASS (_gtk_color_swatch_accessible_parent_class)->initialize (obj, data); - - g_signal_connect (data, "state-flags-changed", - G_CALLBACK (state_changed_cb), - obj); - g_signal_connect (data, "notify::selectable", - G_CALLBACK (on_selectable_changed_cb), - obj); - - obj->role = gtk_color_swatch_get_selectable (swatch) - ? ATK_ROLE_RADIO_BUTTON - : ATK_ROLE_PUSH_BUTTON; -} - -static AtkStateSet * -gtk_color_swatch_accessible_ref_state_set (AtkObject *accessible) -{ - GtkWidget *widget; - AtkStateSet *state_set; - - state_set = ATK_OBJECT_CLASS (_gtk_color_swatch_accessible_parent_class)->ref_state_set (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget != NULL) - { - if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_SELECTED) != 0) - atk_state_set_add_state (state_set, ATK_STATE_CHECKED); - } - - return state_set; -} - -static void -_gtk_color_swatch_accessible_class_init (GtkColorSwatchAccessibleClass *klass) -{ - AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); - - atk_class->initialize = gtk_color_swatch_accessible_initialize; - atk_class->ref_state_set = gtk_color_swatch_accessible_ref_state_set; -} - -static void -_gtk_color_swatch_accessible_init (GtkColorSwatchAccessible *self) -{ - ATK_OBJECT (self)->role = ATK_ROLE_RADIO_BUTTON; -} - -static int -gtk_color_swatch_accessible_get_n_actions (AtkAction *action) -{ - return 3; -} - -static const char * -gtk_color_swatch_accessible_get_keybinding (AtkAction *action, - int i) -{ - return NULL; -} - -static const char * -gtk_color_swatch_accessible_get_name (AtkAction *action, - int i) -{ - switch (i) - { - case 0: return "select"; - case 1: return "activate"; - case 2: return "customize"; - default: return NULL; - } -} - -static const char * -gtk_color_swatch_accessible_get_localized_name (AtkAction *action, - int i) -{ - switch (i) - { - case 0: return C_("Action name", "Select"); - case 1: return C_("Action name", "Activate"); - case 2: return C_("Action name", "Customize"); - default: return NULL; - } -} - -static const char * -gtk_color_swatch_accessible_get_description (AtkAction *action, - int i) -{ - switch (i) - { - case 0: return C_("Action description", "Selects the color"); - case 1: return C_("Action description", "Activates the color"); - case 2: return C_("Action description", "Customizes the color"); - default: return NULL; - } -} - -static gboolean -gtk_color_swatch_accessible_do_action (AtkAction *action, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - switch (i) - { - case 0: - gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, FALSE); - break; - - case 1: - g_signal_emit_by_name (widget, "activate"); - break; - - case 2: - g_signal_emit_by_name (widget, "customize"); - break; - - default: - return FALSE; - } - - return TRUE; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_color_swatch_accessible_do_action; - iface->get_n_actions = gtk_color_swatch_accessible_get_n_actions; - iface->get_keybinding = gtk_color_swatch_accessible_get_keybinding; - iface->get_name = gtk_color_swatch_accessible_get_name; - iface->get_localized_name = gtk_color_swatch_accessible_get_localized_name; - iface->get_description = gtk_color_swatch_accessible_get_description; -} diff --git a/gtk/a11y/gtkcolorswatchaccessibleprivate.h b/gtk/a11y/gtkcolorswatchaccessibleprivate.h deleted file mode 100644 index 123f65f7a8..0000000000 --- a/gtk/a11y/gtkcolorswatchaccessibleprivate.h +++ /dev/null @@ -1,52 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2012, Red Hat, Inc - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_COLOR_SWATCH_ACCESSIBLE_H__ -#define __GTK_COLOR_SWATCH_ACCESSIBLE_H__ - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_COLOR_SWATCH_ACCESSIBLE (_gtk_color_swatch_accessible_get_type ()) -#define GTK_COLOR_SWATCH_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE, GtkColorSwatchAccessible)) -#define GTK_COLOR_SWATCH_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE, GtkColorSwatchAccessibleClass)) -#define GTK_IS_COLOR_SWATCH_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE)) -#define GTK_IS_COLOR_SWATCH_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE)) -#define GTK_COLOR_SWATCH_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE, GtkColorSwatchAccessibleClass)) - -typedef struct _GtkColorSwatchAccessible GtkColorSwatchAccessible; -typedef struct _GtkColorSwatchAccessibleClass GtkColorSwatchAccessibleClass; -typedef struct _GtkColorSwatchAccessiblePrivate GtkColorSwatchAccessiblePrivate; - -struct _GtkColorSwatchAccessible -{ - GtkWidgetAccessible parent; - - GtkColorSwatchAccessiblePrivate *priv; -}; - -struct _GtkColorSwatchAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GType _gtk_color_swatch_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_COLOR_SWATCH_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkcomboboxaccessible.c b/gtk/a11y/gtkcomboboxaccessible.c deleted file mode 100644 index 454b4730f3..0000000000 --- a/gtk/a11y/gtkcomboboxaccessible.c +++ /dev/null @@ -1,435 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2004 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <glib/gi18n-lib.h> -#include <gtk/gtk.h> -#include "gtkcomboboxaccessible.h" - -struct _GtkComboBoxAccessiblePrivate -{ - char *name; - int old_selection; - gboolean popup_set; -}; - -static void atk_action_interface_init (AtkActionIface *iface); -static void atk_selection_interface_init (AtkSelectionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkComboBoxAccessible, gtk_combo_box_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkComboBoxAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) - -static void -changed_cb (GtkWidget *widget) -{ - GtkComboBox *combo_box; - AtkObject *obj; - GtkComboBoxAccessible *accessible; - int index; - - combo_box = GTK_COMBO_BOX (widget); - - index = gtk_combo_box_get_active (combo_box); - obj = gtk_widget_get_accessible (widget); - accessible = GTK_COMBO_BOX_ACCESSIBLE (obj); - if (accessible->priv->old_selection != index) - { - accessible->priv->old_selection = index; - g_object_notify (G_OBJECT (obj), "accessible-name"); - g_signal_emit_by_name (obj, "selection-changed"); - } -} - -static void -gtk_combo_box_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkComboBox *combo_box; - GtkComboBoxAccessible *accessible; - AtkObject *popup; - - ATK_OBJECT_CLASS (gtk_combo_box_accessible_parent_class)->initialize (obj, data); - - combo_box = GTK_COMBO_BOX (data); - accessible = GTK_COMBO_BOX_ACCESSIBLE (obj); - - g_signal_connect (combo_box, "changed", G_CALLBACK (changed_cb), NULL); - accessible->priv->old_selection = gtk_combo_box_get_active (combo_box); - - popup = gtk_combo_box_get_popup_accessible (combo_box); - if (popup) - { - atk_object_set_parent (popup, obj); - accessible->priv->popup_set = TRUE; - } - if (gtk_combo_box_get_has_entry (combo_box)) - atk_object_set_parent (gtk_widget_get_accessible (gtk_combo_box_get_child (GTK_COMBO_BOX (combo_box))), obj); - - obj->role = ATK_ROLE_COMBO_BOX; -} - -static void -gtk_combo_box_accessible_finalize (GObject *object) -{ - GtkComboBoxAccessible *combo_box = GTK_COMBO_BOX_ACCESSIBLE (object); - - g_free (combo_box->priv->name); - - G_OBJECT_CLASS (gtk_combo_box_accessible_parent_class)->finalize (object); -} - -static const char * -gtk_combo_box_accessible_get_name (AtkObject *obj) -{ - GtkWidget *widget; - GtkComboBox *combo_box; - GtkComboBoxAccessible *accessible; - GtkTreeIter iter; - const char *name; - GtkTreeModel *model; - int n_columns; - int i; - - name = ATK_OBJECT_CLASS (gtk_combo_box_accessible_parent_class)->get_name (obj); - if (name) - return name; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - combo_box = GTK_COMBO_BOX (widget); - accessible = GTK_COMBO_BOX_ACCESSIBLE (obj); - if (gtk_combo_box_get_active_iter (combo_box, &iter)) - { - model = gtk_combo_box_get_model (combo_box); - n_columns = gtk_tree_model_get_n_columns (model); - for (i = 0; i < n_columns; i++) - { - GValue value = G_VALUE_INIT; - - gtk_tree_model_get_value (model, &iter, i, &value); - if (G_VALUE_HOLDS_STRING (&value)) - { - g_free (accessible->priv->name); - accessible->priv->name = g_strdup (g_value_get_string (&value)); - g_value_unset (&value); - break; - } - else - g_value_unset (&value); - } - } - return accessible->priv->name; -} - -static int -gtk_combo_box_accessible_get_n_children (AtkObject* obj) -{ - int n_children = 0; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return 0; - - n_children++; - if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (widget))) - n_children++; - - return n_children; -} - -static AtkObject * -gtk_combo_box_accessible_ref_child (AtkObject *obj, - int i) -{ - GtkWidget *widget; - AtkObject *child; - GtkComboBoxAccessible *box; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - if (i == 0) - { - child = gtk_combo_box_get_popup_accessible (GTK_COMBO_BOX (widget)); - box = GTK_COMBO_BOX_ACCESSIBLE (obj); - if (!box->priv->popup_set) - { - atk_object_set_parent (child, obj); - box->priv->popup_set = TRUE; - } - } - else if (i == 1 && gtk_combo_box_get_has_entry (GTK_COMBO_BOX (widget))) - { - child = gtk_widget_get_accessible (gtk_combo_box_get_child (GTK_COMBO_BOX (widget))); - } - else - { - return NULL; - } - - return g_object_ref (child); -} - -static void -gtk_combo_box_accessible_class_init (GtkComboBoxAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - gobject_class->finalize = gtk_combo_box_accessible_finalize; - - class->get_name = gtk_combo_box_accessible_get_name; - class->get_n_children = gtk_combo_box_accessible_get_n_children; - class->ref_child = gtk_combo_box_accessible_ref_child; - class->initialize = gtk_combo_box_accessible_initialize; -} - -static void -gtk_combo_box_accessible_init (GtkComboBoxAccessible *combo_box) -{ - combo_box->priv = gtk_combo_box_accessible_get_instance_private (combo_box); - combo_box->priv->old_selection = -1; - combo_box->priv->name = NULL; - combo_box->priv->popup_set = FALSE; -} - -static gboolean -gtk_combo_box_accessible_do_action (AtkAction *action, - int i) -{ - GtkComboBox *combo_box; - GtkWidget *widget; - gboolean popup_shown; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - if (i != 0) - return FALSE; - - combo_box = GTK_COMBO_BOX (widget); - g_object_get (combo_box, "popup-shown", &popup_shown, NULL); - if (popup_shown) - gtk_combo_box_popdown (combo_box); - else - gtk_combo_box_popup (combo_box); - - return TRUE; -} - -static int -gtk_combo_box_accessible_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_combo_box_accessible_get_keybinding (AtkAction *action, - int i) -{ - GtkComboBoxAccessible *combo_box; - GtkWidget *widget; - GtkWidget *label; - AtkRelationSet *set; - AtkRelation *relation; - GPtrArray *target; - gpointer target_object; - guint key_val; - char *return_value = NULL; - - if (i != 0) - return NULL; - - combo_box = GTK_COMBO_BOX_ACCESSIBLE (action); - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (combo_box)); - if (widget == NULL) - return NULL; - - set = atk_object_ref_relation_set (ATK_OBJECT (action)); - if (set == NULL) - return NULL; - - label = NULL; - relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY); - if (relation) - { - target = atk_relation_get_target (relation); - target_object = g_ptr_array_index (target, 0); - label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object)); - } - g_object_unref (set); - if (GTK_IS_LABEL (label)) - { - key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); - if (key_val != GDK_KEY_VoidSymbol) - return_value = gtk_accelerator_name (key_val, GDK_ALT_MASK); - } - - return return_value; -} - -static const char * -gtk_combo_box_accessible_action_get_name (AtkAction *action, - int i) -{ - if (i == 0) - return "press"; - return NULL; -} - -static const char * -gtk_combo_box_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Press"); - return NULL; -} - -static const char * -gtk_combo_box_accessible_action_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Presses the combobox"); - return NULL; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_combo_box_accessible_do_action; - iface->get_n_actions = gtk_combo_box_accessible_get_n_actions; - iface->get_keybinding = gtk_combo_box_accessible_get_keybinding; - iface->get_name = gtk_combo_box_accessible_action_get_name; - iface->get_localized_name = gtk_combo_box_accessible_action_get_localized_name; - iface->get_description = gtk_combo_box_accessible_action_get_description; -} - -static gboolean -gtk_combo_box_accessible_add_selection (AtkSelection *selection, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i); - - return TRUE; -} - -static gboolean -gtk_combo_box_accessible_clear_selection (AtkSelection *selection) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - gtk_combo_box_set_active (GTK_COMBO_BOX (widget), -1); - - return TRUE; -} - -static AtkObject * -gtk_combo_box_accessible_ref_selection (AtkSelection *selection, - int i) -{ - GtkComboBox *combo_box; - GtkWidget *widget; - AtkObject *obj; - int index; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return NULL; - - if (i != 0) - return NULL; - - combo_box = GTK_COMBO_BOX (widget); - - obj = gtk_combo_box_get_popup_accessible (combo_box); - index = gtk_combo_box_get_active (combo_box); - - return atk_object_ref_accessible_child (obj, index); -} - -static int -gtk_combo_box_accessible_get_selection_count (AtkSelection *selection) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return 0; - - return (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == -1) ? 0 : 1; -} - -static gboolean -gtk_combo_box_accessible_is_child_selected (AtkSelection *selection, - int i) -{ - GtkWidget *widget; - int j; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - - if (widget == NULL) - return FALSE; - - j = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)); - - return (j == i); -} - -static gboolean -gtk_combo_box_accessible_remove_selection (AtkSelection *selection, - int i) -{ - if (atk_selection_is_child_selected (selection, i)) - atk_selection_clear_selection (selection); - - return TRUE; -} - -static void -atk_selection_interface_init (AtkSelectionIface *iface) -{ - iface->add_selection = gtk_combo_box_accessible_add_selection; - iface->clear_selection = gtk_combo_box_accessible_clear_selection; - iface->ref_selection = gtk_combo_box_accessible_ref_selection; - iface->get_selection_count = gtk_combo_box_accessible_get_selection_count; - iface->is_child_selected = gtk_combo_box_accessible_is_child_selected; - iface->remove_selection = gtk_combo_box_accessible_remove_selection; -} diff --git a/gtk/a11y/gtkcomboboxaccessible.h b/gtk/a11y/gtkcomboboxaccessible.h deleted file mode 100644 index 4ce10b1e8b..0000000000 --- a/gtk/a11y/gtkcomboboxaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2004 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_COMBO_BOX_ACCESSIBLE_H__ -#define __GTK_COMBO_BOX_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_COMBO_BOX_ACCESSIBLE (gtk_combo_box_accessible_get_type ()) -#define GTK_COMBO_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COMBO_BOX_ACCESSIBLE, GtkComboBoxAccessible)) -#define GTK_COMBO_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COMBO_BOX_ACCESSIBLE, GtkComboBoxAccessibleClass)) -#define GTK_IS_COMBO_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COMBO_BOX_ACCESSIBLE)) -#define GTK_IS_COMBO_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COMBO_BOX_ACCESSIBLE)) -#define GTK_COMBO_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COMBO_BOX_ACCESSIBLE, GtkComboBoxAccessibleClass)) - -typedef struct _GtkComboBoxAccessible GtkComboBoxAccessible; -typedef struct _GtkComboBoxAccessibleClass GtkComboBoxAccessibleClass; -typedef struct _GtkComboBoxAccessiblePrivate GtkComboBoxAccessiblePrivate; - -struct _GtkComboBoxAccessible -{ - GtkWidgetAccessible parent; - - GtkComboBoxAccessiblePrivate *priv; -}; - -struct _GtkComboBoxAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_combo_box_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_COMBO_BOX_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkcompositeaccessible.c b/gtk/a11y/gtkcompositeaccessible.c deleted file mode 100644 index 8e8a6297b3..0000000000 --- a/gtk/a11y/gtkcompositeaccessible.c +++ /dev/null @@ -1,87 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2020 Red Hat, Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkcompositeaccessible.h" - -#include <gtk/gtk.h> - -#include "gtkwidgetprivate.h" - -G_DEFINE_TYPE (GtkCompositeAccessible, gtk_composite_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static int -gtk_composite_accessible_get_n_children (AtkObject *obj) -{ - GtkWidget *widget; - GtkWidget *child; - int count = 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return 0; - - for (child = gtk_widget_get_first_child (widget); child; child = gtk_widget_get_next_sibling (child)) - count++; - - return count; -} - -static AtkObject * -gtk_composite_accessible_ref_child (AtkObject *obj, - int i) -{ - GtkWidget *widget; - GtkWidget *child; - int pos; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - for (child = gtk_widget_get_first_child (widget), pos = 0; child && pos < i; child = gtk_widget_get_next_sibling (child), pos++); - - if (child) - return g_object_ref (gtk_widget_get_accessible (GTK_WIDGET (child))); - - return NULL; -} - -static void -gtk_composite_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_composite_accessible_parent_class)->initialize (obj, data); - - obj->role = ATK_ROLE_FILLER; -} - -static void -gtk_composite_accessible_class_init (GtkCompositeAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->initialize = gtk_composite_accessible_initialize; - class->get_n_children = gtk_composite_accessible_get_n_children; - class->ref_child = gtk_composite_accessible_ref_child; -} - -static void -gtk_composite_accessible_init (GtkCompositeAccessible *composite) -{ -} diff --git a/gtk/a11y/gtkcompositeaccessible.h b/gtk/a11y/gtkcompositeaccessible.h deleted file mode 100644 index bc6a2bbafc..0000000000 --- a/gtk/a11y/gtkcompositeaccessible.h +++ /dev/null @@ -1,55 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2020 Red Hat, Inc - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_COMPOSITE_ACCESSIBLE_H__ -#define __GTK_COMPOSITE_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/gtkwidget.h> -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_COMPOSITE_ACCESSIBLE (gtk_composite_accessible_get_type ()) -#define GTK_COMPOSITE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COMPOSITE_ACCESSIBLE, GtkCompositeAccessible)) -#define GTK_COMPOSITE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COMPOSITE_ACCESSIBLE, GtkCompositeAccessibleClass)) -#define GTK_IS_COMPOSITE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COMPOSITE_ACCESSIBLE)) -#define GTK_IS_COMPOSITE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COMPOSITE_ACCESSIBLE)) -#define GTK_COMPOSITE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COMPOSITE_ACCESSIBLE, GtkCompositeAccessibleClass)) - -typedef struct _GtkCompositeAccessible GtkCompositeAccessible; -typedef struct _GtkCompositeAccessibleClass GtkCompositeAccessibleClass; - -struct _GtkCompositeAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkCompositeAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_composite_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_COMPOSITE_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkcontainercellaccessible.c b/gtk/a11y/gtkcontainercellaccessible.c deleted file mode 100644 index e581d98afc..0000000000 --- a/gtk/a11y/gtkcontainercellaccessible.c +++ /dev/null @@ -1,180 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtkcontainercellaccessible.h" -#include "gtkcellaccessibleprivate.h" - -struct _GtkContainerCellAccessiblePrivate -{ - GList *children; - int n_children; -}; - -G_DEFINE_TYPE_WITH_PRIVATE (GtkContainerCellAccessible, gtk_container_cell_accessible, GTK_TYPE_CELL_ACCESSIBLE) - - -static void -gtk_container_cell_accessible_finalize (GObject *obj) -{ - GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (obj); - - g_list_free_full (container->priv->children, g_object_unref); - - G_OBJECT_CLASS (gtk_container_cell_accessible_parent_class)->finalize (obj); -} - - -static int -gtk_container_cell_accessible_get_n_children (AtkObject *obj) -{ - GtkContainerCellAccessible *cell = GTK_CONTAINER_CELL_ACCESSIBLE (obj); - - return cell->priv->n_children; -} - -static AtkObject * -gtk_container_cell_accessible_ref_child (AtkObject *obj, - int child) -{ - GtkContainerCellAccessible *cell = GTK_CONTAINER_CELL_ACCESSIBLE (obj); - GList *l; - - l = g_list_nth (cell->priv->children, child); - if (l == NULL) - return NULL; - - return g_object_ref (ATK_OBJECT (l->data)); -} - -static void -gtk_container_cell_accessible_update_cache (GtkCellAccessible *cell, - gboolean emit_signal) -{ - GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (cell); - GList *l; - - for (l = container->priv->children; l; l = l->next) - _gtk_cell_accessible_update_cache (l->data, emit_signal); -} - -static void -gtk_container_cell_widget_set (GtkAccessible *accessible) -{ - GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (accessible); - GList *l; - - for (l = container->priv->children; l; l = l->next) - gtk_accessible_set_widget (l->data, gtk_accessible_get_widget (accessible)); - - GTK_ACCESSIBLE_CLASS (gtk_container_cell_accessible_parent_class)->widget_set (accessible); -} - -static void -gtk_container_cell_widget_unset (GtkAccessible *accessible) -{ - GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (accessible); - GList *l; - - for (l = container->priv->children; l; l = l->next) - gtk_accessible_set_widget (l->data, NULL); - - GTK_ACCESSIBLE_CLASS (gtk_container_cell_accessible_parent_class)->widget_unset (accessible); -} - -static void -gtk_container_cell_accessible_class_init (GtkContainerCellAccessibleClass *klass) -{ - GtkCellAccessibleClass *cell_class = GTK_CELL_ACCESSIBLE_CLASS (klass); - GtkAccessibleClass *accessible_class = GTK_ACCESSIBLE_CLASS (klass); - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - GObjectClass *g_object_class = G_OBJECT_CLASS (klass); - - g_object_class->finalize = gtk_container_cell_accessible_finalize; - - class->get_n_children = gtk_container_cell_accessible_get_n_children; - class->ref_child = gtk_container_cell_accessible_ref_child; - - accessible_class->widget_set = gtk_container_cell_widget_set; - accessible_class->widget_unset = gtk_container_cell_widget_unset; - - cell_class->update_cache = gtk_container_cell_accessible_update_cache; -} - -static void -gtk_container_cell_accessible_init (GtkContainerCellAccessible *cell) -{ - cell->priv = gtk_container_cell_accessible_get_instance_private (cell); -} - -GtkContainerCellAccessible * -gtk_container_cell_accessible_new (void) -{ - GObject *object; - - object = g_object_new (GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, NULL); - - ATK_OBJECT (object)->role = ATK_ROLE_TABLE_CELL; - - return GTK_CONTAINER_CELL_ACCESSIBLE (object); -} - -void -gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container, - GtkCellAccessible *child) -{ - g_return_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container)); - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child)); - - g_object_ref (child); - - container->priv->n_children++; - container->priv->children = g_list_append (container->priv->children, child); - atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (container)); -} - -void -gtk_container_cell_accessible_remove_child (GtkContainerCellAccessible *container, - GtkCellAccessible *child) -{ - g_return_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container)); - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child)); - g_return_if_fail (container->priv->n_children > 0); - - container->priv->children = g_list_remove (container->priv->children, child); - container->priv->n_children--; - - g_object_unref (child); -} - -/** - * gtk_container_cell_accessible_get_children: - * @container: the container - * - * Get a list of children. - * - * Returns: (transfer none) (element-type Gtk.CellAccessible) - */ -GList * -gtk_container_cell_accessible_get_children (GtkContainerCellAccessible *container) -{ - g_return_val_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container), NULL); - - return container->priv->children; -} diff --git a/gtk/a11y/gtkcontainercellaccessible.h b/gtk/a11y/gtkcontainercellaccessible.h deleted file mode 100644 index d05d8b19e0..0000000000 --- a/gtk/a11y/gtkcontainercellaccessible.h +++ /dev/null @@ -1,69 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_CONTAINER_CELL_ACCESSIBLE_H__ -#define __GTK_CONTAINER_CELL_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <atk/atk.h> -#include <gtk/a11y/gtkcellaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_CONTAINER_CELL_ACCESSIBLE (gtk_container_cell_accessible_get_type ()) -#define GTK_CONTAINER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessible)) -#define GTK_CONTAINER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessibleClass)) -#define GTK_IS_CONTAINER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE)) -#define GTK_IS_CONTAINER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE)) -#define GTK_CONTAINER_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessibleClass)) - -typedef struct _GtkContainerCellAccessible GtkContainerCellAccessible; -typedef struct _GtkContainerCellAccessibleClass GtkContainerCellAccessibleClass; -typedef struct _GtkContainerCellAccessiblePrivate GtkContainerCellAccessiblePrivate; - -struct _GtkContainerCellAccessible -{ - GtkCellAccessible parent; - - GtkContainerCellAccessiblePrivate *priv; -}; - -struct _GtkContainerCellAccessibleClass -{ - GtkCellAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_container_cell_accessible_get_type (void); - -GDK_AVAILABLE_IN_ALL -GtkContainerCellAccessible *gtk_container_cell_accessible_new (void); -GDK_AVAILABLE_IN_ALL -void gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container, - GtkCellAccessible *child); -GDK_AVAILABLE_IN_ALL -void gtk_container_cell_accessible_remove_child (GtkContainerCellAccessible *container, - GtkCellAccessible *child); -GDK_AVAILABLE_IN_ALL -GList *gtk_container_cell_accessible_get_children (GtkContainerCellAccessible *container); - -G_END_DECLS - -#endif /* __GTK_CONTAINER_CELL_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c deleted file mode 100644 index 19eec7ef49..0000000000 --- a/gtk/a11y/gtkentryaccessible.c +++ /dev/null @@ -1,1537 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkentryaccessible.h" - -#include "gtkcomboboxaccessible.h" - -#include "gtkentryprivate.h" -#include "gtklabel.h" -#include "gtkpango.h" -#include "gtkstylecontextprivate.h" -#include "gtktextprivate.h" -#include "gtkwidgetprivate.h" - -#include "gdk/gdkeventsprivate.h" - -#include <glib/gi18n-lib.h> -#include <string.h> - -#define GTK_TYPE_ENTRY_ICON_ACCESSIBLE (gtk_entry_icon_accessible_get_type ()) -#define GTK_ENTRY_ICON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_ICON_ACCESSIBLE, GtkEntryIconAccessible)) -#define GTK_IS_ENTRY_ICON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_ICON_ACCESSIBLE)) - -struct _GtkEntryAccessiblePrivate -{ - int cursor_position; - int selection_bound; - AtkObject *icons[2]; -}; - -typedef struct _GtkEntryIconAccessible GtkEntryIconAccessible; -typedef struct _GtkEntryIconAccessibleClass GtkEntryIconAccessibleClass; - -struct _GtkEntryIconAccessible -{ - AtkObject parent; - - GtkEntryAccessible *entry; - GtkEntryIconPosition pos; -}; - -struct _GtkEntryIconAccessibleClass -{ - AtkObjectClass parent_class; -}; - -static void icon_atk_action_interface_init (AtkActionIface *iface); -static void icon_atk_component_interface_init (AtkComponentIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkEntryIconAccessible, gtk_entry_icon_accessible, ATK_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, icon_atk_action_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, icon_atk_component_interface_init)) - -static void -gtk_entry_icon_accessible_remove_entry (gpointer data, GObject *obj) -{ - GtkEntryIconAccessible *icon = data; - - if (icon->entry) - { - icon->entry = NULL; - g_object_notify (G_OBJECT (icon), "accessible-parent"); - atk_object_notify_state_change (ATK_OBJECT (icon), ATK_STATE_DEFUNCT, TRUE); - } -} - -static AtkObject * -gtk_entry_icon_accessible_new (GtkEntryAccessible *entry, - GtkEntryIconPosition pos) -{ - GtkEntryIconAccessible *icon; - AtkObject *accessible; - - icon = g_object_new (gtk_entry_icon_accessible_get_type (), NULL); - icon->entry = entry; - g_object_weak_ref (G_OBJECT (entry), - gtk_entry_icon_accessible_remove_entry, - icon); - icon->pos = pos; - - accessible = ATK_OBJECT (icon); - atk_object_initialize (accessible, NULL); - return accessible; -} - -static void -gtk_entry_icon_accessible_init (GtkEntryIconAccessible *icon) -{ -} - -static void -gtk_entry_icon_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (obj); - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry)); - GtkEntry *gtk_entry = GTK_ENTRY (widget); - const char *name; - char *text; - - ATK_OBJECT_CLASS (gtk_entry_icon_accessible_parent_class)->initialize (obj, data); - atk_object_set_role (obj, ATK_ROLE_ICON); - - name = gtk_entry_get_icon_name (gtk_entry, icon->pos); - if (name) - atk_object_set_name (obj, name); - - text = gtk_entry_get_icon_tooltip_text (gtk_entry, icon->pos); - if (text) - { - atk_object_set_description (obj, text); - g_free (text); - } - - atk_object_set_parent (obj, ATK_OBJECT (icon->entry)); -} - -static AtkObject * -gtk_entry_icon_accessible_get_parent (AtkObject *accessible) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (accessible); - - return ATK_OBJECT (icon->entry); -} - -static AtkStateSet * -gtk_entry_icon_accessible_ref_state_set (AtkObject *accessible) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (accessible); - AtkStateSet *set = atk_state_set_new (); - AtkStateSet *entry_set; - GtkWidget *widget; - GtkEntry *gtk_entry; - - if (!icon->entry) - { - atk_state_set_add_state (set, ATK_STATE_DEFUNCT); - return set; - } - - entry_set = atk_object_ref_state_set (ATK_OBJECT (icon->entry)); - if (!entry_set || atk_state_set_contains_state (entry_set, ATK_STATE_DEFUNCT)) - { - atk_state_set_add_state (set, ATK_STATE_DEFUNCT); - g_clear_object (&entry_set); - return set; - } - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry)); - gtk_entry = GTK_ENTRY (widget); - - if (atk_state_set_contains_state (entry_set, ATK_STATE_ENABLED)) - atk_state_set_add_state (set, ATK_STATE_ENABLED); - if (atk_state_set_contains_state (entry_set, ATK_STATE_SENSITIVE)) - atk_state_set_add_state (set, ATK_STATE_SENSITIVE); - if (atk_state_set_contains_state (entry_set, ATK_STATE_SHOWING)) - atk_state_set_add_state (set, ATK_STATE_SHOWING); - if (atk_state_set_contains_state (entry_set, ATK_STATE_VISIBLE)) - atk_state_set_add_state (set, ATK_STATE_VISIBLE); - - if (!gtk_entry_get_icon_sensitive (gtk_entry, icon->pos)) - atk_state_set_remove_state (set, ATK_STATE_SENSITIVE); - if (!gtk_entry_get_icon_activatable (gtk_entry, icon->pos)) - atk_state_set_remove_state (set, ATK_STATE_ENABLED); - - g_object_unref (entry_set); - return set; -} - -static void -gtk_entry_icon_accessible_invalidate (GtkEntryIconAccessible *icon) -{ - if (!icon->entry) - return; - g_object_weak_unref (G_OBJECT (icon->entry), - gtk_entry_icon_accessible_remove_entry, - icon); - gtk_entry_icon_accessible_remove_entry (icon, NULL); -} - -static void -gtk_entry_icon_accessible_finalize (GObject *object) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (object); - - gtk_entry_icon_accessible_invalidate (icon); - - G_OBJECT_CLASS (gtk_entry_icon_accessible_parent_class)->finalize (object); -} - -static void -gtk_entry_icon_accessible_class_init (GtkEntryIconAccessibleClass *klass) -{ - AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - atk_class->initialize = gtk_entry_icon_accessible_initialize; - atk_class->get_parent = gtk_entry_icon_accessible_get_parent; - atk_class->ref_state_set = gtk_entry_icon_accessible_ref_state_set; - - gobject_class->finalize = gtk_entry_icon_accessible_finalize; -} - -static gboolean -gtk_entry_icon_accessible_do_action (AtkAction *action, - int i) -{ - GtkEntryIconAccessible *icon = (GtkEntryIconAccessible *)action; - GtkWidget *widget; - GtkEntry *gtk_entry; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry)); - if (widget == NULL) - return FALSE; - - if (i != 0) - return FALSE; - - if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - gtk_entry = GTK_ENTRY (widget); - - if (!gtk_entry_get_icon_sensitive (gtk_entry, icon->pos) || - !gtk_entry_get_icon_activatable (gtk_entry, icon->pos)) - return FALSE; - - g_signal_emit_by_name (widget, "icon-press", 0, icon->pos); - return TRUE; -} - -static int -gtk_entry_icon_accessible_get_n_actions (AtkAction *action) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (action); - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry)); - GtkEntry *gtk_entry = GTK_ENTRY (widget); - - return (gtk_entry_get_icon_activatable (gtk_entry, icon->pos) ? 1 : 0); -} - -static const char * -gtk_entry_icon_accessible_get_name (AtkAction *action, - int i) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (action); - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry)); - GtkEntry *gtk_entry = GTK_ENTRY (widget); - - if (i != 0) - return NULL; - if (!gtk_entry_get_icon_activatable (gtk_entry, icon->pos)) - return NULL; - - return "activate"; -} - -static void -icon_atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_entry_icon_accessible_do_action; - iface->get_n_actions = gtk_entry_icon_accessible_get_n_actions; - iface->get_name = gtk_entry_icon_accessible_get_name; -} - -static void -gtk_entry_icon_accessible_get_extents (AtkComponent *component, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (component); - GdkRectangle icon_area; - GtkEntry *gtk_entry; - GtkWidget *widget; - - *x = G_MININT; - atk_component_get_extents (ATK_COMPONENT (icon->entry), x, y, width, height, - coord_type); - if (*x == G_MININT) - return; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry)); - gtk_entry = GTK_ENTRY (widget); - gtk_entry_get_icon_area (gtk_entry, icon->pos, &icon_area); - *width = icon_area.width; - *height = icon_area.height; - *x += icon_area.x; - *y += icon_area.y; -} - -static void -gtk_entry_icon_accessible_get_position (AtkComponent *component, - int *x, - int *y, - AtkCoordType coord_type) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (component); - GdkRectangle icon_area; - GtkEntry *gtk_entry; - GtkWidget *widget; - - *x = G_MININT; - atk_component_get_extents (ATK_COMPONENT (icon->entry), x, y, NULL, NULL, - coord_type); - if (*x == G_MININT) - return; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry)); - gtk_entry = GTK_ENTRY (widget); - gtk_entry_get_icon_area (gtk_entry, icon->pos, &icon_area); - *x += icon_area.x; - *y += icon_area.y; -} - -static void -gtk_entry_icon_accessible_get_size (AtkComponent *component, - int *width, - int *height) -{ - GtkEntryIconAccessible *icon = GTK_ENTRY_ICON_ACCESSIBLE (component); - GdkRectangle icon_area; - GtkEntry *gtk_entry; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (icon->entry)); - gtk_entry = GTK_ENTRY (widget); - gtk_entry_get_icon_area (gtk_entry, icon->pos, &icon_area); - *width = icon_area.width; - *height = icon_area.height; -} - -static void -icon_atk_component_interface_init (AtkComponentIface *iface) -{ - iface->get_extents = gtk_entry_icon_accessible_get_extents; - iface->get_size = gtk_entry_icon_accessible_get_size; - iface->get_position = gtk_entry_icon_accessible_get_position; -} - -/* Callbacks */ -static gboolean check_for_selection_change (GtkEntryAccessible *entry, - GtkEditable *editable); - - -static void atk_editable_text_interface_init (AtkEditableTextIface *iface); -static void atk_text_interface_init (AtkTextIface *iface); -static void atk_action_interface_init (AtkActionIface *iface); - - -G_DEFINE_TYPE_WITH_CODE (GtkEntryAccessible, gtk_entry_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkEntryAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - -static GtkText * -get_text (AtkText *atk_text) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return NULL; - - return gtk_entry_get_text_widget (GTK_ENTRY (widget)); -} - -static gboolean -check_for_selection_change (GtkEntryAccessible *accessible, - GtkEditable *editable) -{ - gboolean ret_val = FALSE; - int start, end; - - if (gtk_editable_get_selection_bounds (editable, &start, &end)) - { - if (end != accessible->priv->cursor_position || - start != accessible->priv->selection_bound) - /* - * This check is here as this function can be called - * for notification of selection_bound and current_pos. - * The values of current_pos and selection_bound may be the same - * for both notifications and we only want to generate one - * text_selection_changed signal. - */ - ret_val = TRUE; - } - else - { - /* We had a selection */ - ret_val = (accessible->priv->cursor_position != accessible->priv->selection_bound); - } - - accessible->priv->cursor_position = end; - accessible->priv->selection_bound = start; - - return ret_val; -} - -static void -insert_text_cb (GtkEditable *editable, - char *new_text, - int new_text_length, - int *position, - GtkEntryAccessible *self) -{ - int length; - - if (new_text_length == 0) - return; - - length = g_utf8_strlen (new_text, new_text_length); - - g_signal_emit_by_name (self, - "text-changed::insert", - *position - length, - length); -} - -/* We connect to GtkEditable::delete-text, since it carries - * the information we need. But we delay emitting our own - * text_changed::delete signal until the entry has update - * all its internal state and emits GtkEntry::changed. - */ -static void -delete_text_cb (GtkEditable *editable, - int start, - int end, - GtkEntryAccessible *self) -{ - GtkText *textw; - - textw = get_text (ATK_TEXT (self)); - if (textw == NULL) - return; - - if (end < 0) - { - char *text; - - text = gtk_text_get_display_text (textw, 0, -1); - end = g_utf8_strlen (text, -1); - g_free (text); - } - - if (end == start) - return; - - g_signal_emit_by_name (self, - "text-changed::delete", - start, - end - start); -} - -static void -on_notify (GObject *gobject, - GParamSpec *pspec, - GtkEntryAccessible *self) -{ - GtkWidget *widget; - AtkObject* atk_obj; - GtkEntryAccessiblePrivate *priv; - - widget = GTK_WIDGET (gobject); - atk_obj = gtk_widget_get_accessible (widget); - priv = gtk_entry_accessible_get_instance_private (self); - - if (g_strcmp0 (pspec->name, "cursor-position") == 0) - { - if (check_for_selection_change (self, GTK_EDITABLE (widget))) - g_signal_emit_by_name (atk_obj, "text-selection-changed"); - /* - * The entry cursor position has moved so generate the signal. - */ - g_signal_emit_by_name (atk_obj, "text-caret-moved", - gtk_editable_get_position (GTK_EDITABLE (widget))); - } - else if (g_strcmp0 (pspec->name, "selection-bound") == 0) - { - if (check_for_selection_change (self, GTK_EDITABLE (widget))) - g_signal_emit_by_name (atk_obj, "text-selection-changed"); - } - else if (g_strcmp0 (pspec->name, "editable") == 0) - { - gboolean value; - - g_object_get (gobject, "editable", &value, NULL); - atk_object_notify_state_change (atk_obj, ATK_STATE_EDITABLE, value); - } - else if (g_strcmp0 (pspec->name, "visibility") == 0) - { - gboolean visibility; - AtkRole new_role; - - visibility = gtk_entry_get_visibility (GTK_ENTRY (widget)); - new_role = visibility ? ATK_ROLE_TEXT : ATK_ROLE_PASSWORD_TEXT; - atk_object_set_role (atk_obj, new_role); - } - else if (g_strcmp0 (pspec->name, "primary-icon-storage-type") == 0) - { - if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY) != GTK_IMAGE_EMPTY && - !priv->icons[GTK_ENTRY_ICON_PRIMARY]) - { - priv->icons[GTK_ENTRY_ICON_PRIMARY] = gtk_entry_icon_accessible_new (self, GTK_ENTRY_ICON_PRIMARY); - g_signal_emit_by_name (self, "children-changed::add", 0, - priv->icons[GTK_ENTRY_ICON_PRIMARY], NULL); - } - else if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY) == GTK_IMAGE_EMPTY && - priv->icons[GTK_ENTRY_ICON_PRIMARY]) - { - gtk_entry_icon_accessible_invalidate (GTK_ENTRY_ICON_ACCESSIBLE (priv->icons[GTK_ENTRY_ICON_PRIMARY])); - g_signal_emit_by_name (self, "children-changed::remove", 0, - priv->icons[GTK_ENTRY_ICON_PRIMARY], NULL); - g_clear_object (&priv->icons[GTK_ENTRY_ICON_PRIMARY]); - } - } - else if (g_strcmp0 (pspec->name, "secondary-icon-storage-type") == 0) - { - int index = (priv->icons[GTK_ENTRY_ICON_PRIMARY] ? 1 : 0); - if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY) != GTK_IMAGE_EMPTY && - !priv->icons[GTK_ENTRY_ICON_SECONDARY]) - { - priv->icons[GTK_ENTRY_ICON_SECONDARY] = gtk_entry_icon_accessible_new (self, GTK_ENTRY_ICON_SECONDARY); - g_signal_emit_by_name (self, "children-changed::add", index, - priv->icons[GTK_ENTRY_ICON_SECONDARY], NULL); - } - else if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY) == GTK_IMAGE_EMPTY && - priv->icons[GTK_ENTRY_ICON_SECONDARY]) - { - gtk_entry_icon_accessible_invalidate (GTK_ENTRY_ICON_ACCESSIBLE (priv->icons[GTK_ENTRY_ICON_SECONDARY])); - g_signal_emit_by_name (self, "children-changed::remove", index, - priv->icons[GTK_ENTRY_ICON_SECONDARY], NULL); - g_clear_object (&priv->icons[GTK_ENTRY_ICON_SECONDARY]); - } - } - else if (g_strcmp0 (pspec->name, "primary-icon-name") == 0) - { - if (priv->icons[GTK_ENTRY_ICON_PRIMARY]) - { - const char *name; - name = gtk_entry_get_icon_name (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY); - if (name) - atk_object_set_name (priv->icons[GTK_ENTRY_ICON_PRIMARY], name); - } - } - else if (g_strcmp0 (pspec->name, "secondary-icon-name") == 0) - { - if (priv->icons[GTK_ENTRY_ICON_SECONDARY]) - { - const char *name; - name = gtk_entry_get_icon_name (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY); - if (name) - atk_object_set_name (priv->icons[GTK_ENTRY_ICON_SECONDARY], name); - } - } - else if (g_strcmp0 (pspec->name, "primary-icon-tooltip-text") == 0) - { - if (priv->icons[GTK_ENTRY_ICON_PRIMARY]) - { - char *text; - text = gtk_entry_get_icon_tooltip_text (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY); - if (text) - { - atk_object_set_description (priv->icons[GTK_ENTRY_ICON_PRIMARY], text); - g_free (text); - } - else - { - atk_object_set_description (priv->icons[GTK_ENTRY_ICON_PRIMARY], ""); - } - } - } - else if (g_strcmp0 (pspec->name, "secondary-icon-tooltip-text") == 0) - { - if (priv->icons[GTK_ENTRY_ICON_SECONDARY]) - { - char *text; - text = gtk_entry_get_icon_tooltip_text (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY); - if (text) - { - atk_object_set_description (priv->icons[GTK_ENTRY_ICON_SECONDARY], text); - g_free (text); - } - else - { - atk_object_set_description (priv->icons[GTK_ENTRY_ICON_SECONDARY], ""); - } - } - } - else if (g_strcmp0 (pspec->name, "primary-icon-activatable") == 0) - { - if (priv->icons[GTK_ENTRY_ICON_PRIMARY]) - { - gboolean on = gtk_entry_get_icon_activatable (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY); - atk_object_notify_state_change (priv->icons[GTK_ENTRY_ICON_PRIMARY], - ATK_STATE_ENABLED, on); - } - } - else if (g_strcmp0 (pspec->name, "secondary-icon-activatable") == 0) - { - if (priv->icons[GTK_ENTRY_ICON_SECONDARY]) - { - gboolean on = gtk_entry_get_icon_activatable (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY); - atk_object_notify_state_change (priv->icons[GTK_ENTRY_ICON_SECONDARY], - ATK_STATE_ENABLED, on); - } - } - else if (g_strcmp0 (pspec->name, "primary-icon-sensitive") == 0) - { - if (priv->icons[GTK_ENTRY_ICON_PRIMARY]) - { - gboolean on = gtk_entry_get_icon_sensitive (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY); - atk_object_notify_state_change (priv->icons[GTK_ENTRY_ICON_PRIMARY], - ATK_STATE_SENSITIVE, on); - } - } - else if (g_strcmp0 (pspec->name, "secondary-icon-sensitive") == 0) - { - if (priv->icons[GTK_ENTRY_ICON_SECONDARY]) - { - gboolean on = gtk_entry_get_icon_sensitive (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY); - atk_object_notify_state_change (priv->icons[GTK_ENTRY_ICON_SECONDARY], - ATK_STATE_SENSITIVE, on); - } - } -} - -static AtkStateSet * -gtk_entry_accessible_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - gboolean value; - GtkWidget *widget; - GtkWidget *text; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - text = gtk_widget_get_first_child (widget); - - state_set = ATK_OBJECT_CLASS (gtk_entry_accessible_parent_class)->ref_state_set (accessible); - - atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); - if (gtk_widget_has_focus (text)) - atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); - - g_object_get (G_OBJECT (widget), "editable", &value, NULL); - if (value) - atk_state_set_add_state (state_set, ATK_STATE_EDITABLE); - atk_state_set_add_state (state_set, ATK_STATE_SINGLE_LINE); - - return state_set; -} - -static AtkAttributeSet * -gtk_entry_accessible_get_attributes (AtkObject *accessible) -{ - GtkWidget *widget; - AtkAttributeSet *attributes; - AtkAttribute *placeholder_text; - char *text = NULL; - - attributes = ATK_OBJECT_CLASS (gtk_entry_accessible_parent_class)->get_attributes (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return attributes; - - g_object_get (widget, "placeholder-text", &text, NULL); - if (text == NULL) - return attributes; - - placeholder_text = g_malloc (sizeof (AtkAttribute)); - placeholder_text->name = g_strdup ("placeholder-text"); - placeholder_text->value = text; - - attributes = g_slist_append (attributes, placeholder_text); - - return attributes; -} - -static void -gtk_entry_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkWidget *widget; - GtkEntryAccessible *gtk_entry_accessible; - int start_pos, end_pos; - - ATK_OBJECT_CLASS (gtk_entry_accessible_parent_class)->initialize (obj, data); - - gtk_entry_accessible = GTK_ENTRY_ACCESSIBLE (obj); - - widget = GTK_WIDGET (data); - gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start_pos, &end_pos); - gtk_entry_accessible->priv->cursor_position = end_pos; - gtk_entry_accessible->priv->selection_bound = start_pos; - - /* Set up signal callbacks */ - g_signal_connect_after (widget, "insert-text", G_CALLBACK (insert_text_cb), obj); - g_signal_connect (widget, "delete-text", G_CALLBACK (delete_text_cb), obj); - g_signal_connect (widget, "notify", G_CALLBACK (on_notify), obj); -} - -static int -gtk_entry_accessible_get_index_in_parent (AtkObject *accessible) -{ - /* - * If the parent widget is a combo box then the index is 1 - * otherwise do the normal thing. - */ - if (accessible->accessible_parent) - if (GTK_IS_COMBO_BOX_ACCESSIBLE (accessible->accessible_parent)) - return 1; - - return ATK_OBJECT_CLASS (gtk_entry_accessible_parent_class)->get_index_in_parent (accessible); -} - -static int -gtk_entry_accessible_get_n_children (AtkObject* obj) -{ - GtkWidget *widget; - int count = 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return 0; - - if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY) != GTK_IMAGE_EMPTY) - count++; - if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY) != GTK_IMAGE_EMPTY) - count++; - - return count; -} - -static AtkObject * -gtk_entry_accessible_ref_child (AtkObject *obj, - int i) -{ - GtkEntryAccessible *accessible = GTK_ENTRY_ACCESSIBLE (obj); - GtkEntryAccessiblePrivate *priv = accessible->priv; - GtkWidget *widget; - GtkEntryIconPosition pos; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - switch (i) - { - case 0: - if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY) != GTK_IMAGE_EMPTY) - pos = GTK_ENTRY_ICON_PRIMARY; - else if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY) != GTK_IMAGE_EMPTY) - pos = GTK_ENTRY_ICON_SECONDARY; - else - return NULL; - break; - case 1: - if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY) == GTK_IMAGE_EMPTY) - return NULL; - if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY) == GTK_IMAGE_EMPTY) - return NULL; - pos = GTK_ENTRY_ICON_SECONDARY; - break; - default: - return NULL; - } - - if (!priv->icons[pos]) - priv->icons[pos] = gtk_entry_icon_accessible_new (accessible, pos); - return g_object_ref (priv->icons[pos]); -} - -static void -gtk_entry_accessible_finalize (GObject *object) -{ - GtkEntryAccessible *entry = GTK_ENTRY_ACCESSIBLE (object); - GtkEntryAccessiblePrivate *priv = entry->priv; - - g_clear_object (&priv->icons[GTK_ENTRY_ICON_PRIMARY]); - g_clear_object (&priv->icons[GTK_ENTRY_ICON_SECONDARY]); - - G_OBJECT_CLASS (gtk_entry_accessible_parent_class)->finalize (object); -} - -static void -gtk_entry_accessible_class_init (GtkEntryAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - class->ref_state_set = gtk_entry_accessible_ref_state_set; - class->get_index_in_parent = gtk_entry_accessible_get_index_in_parent; - class->initialize = gtk_entry_accessible_initialize; - class->get_attributes = gtk_entry_accessible_get_attributes; - class->get_n_children = gtk_entry_accessible_get_n_children; - class->ref_child = gtk_entry_accessible_ref_child; - - gobject_class->finalize = gtk_entry_accessible_finalize; -} - -static void -gtk_entry_accessible_init (GtkEntryAccessible *entry) -{ - entry->priv = gtk_entry_accessible_get_instance_private (entry); - entry->priv->cursor_position = 0; - entry->priv->selection_bound = 0; - - ATK_OBJECT (entry)->role = ATK_ROLE_TEXT; -} - -static char * -gtk_entry_accessible_get_text (AtkText *atk_text, - int start_pos, - int end_pos) -{ - GtkText *text; - - text = get_text (atk_text); - - if (text == NULL) - return NULL; - - return gtk_text_get_display_text (text, start_pos, end_pos); -} - -static char * -gtk_entry_accessible_get_text_before_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkText *text; - - text = get_text (atk_text); - - if (text == NULL) - return NULL; - - return _gtk_pango_get_text_before (gtk_text_get_layout (text), - boundary_type, offset, - start_offset, end_offset); -} - -static char * -gtk_entry_accessible_get_text_at_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkText *text; - - text = get_text (atk_text); - - if (text == NULL) - return NULL; - - return _gtk_pango_get_text_at (gtk_text_get_layout (text), - boundary_type, offset, - start_offset, end_offset); -} - -static char * -gtk_entry_accessible_get_text_after_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkText *text; - - text = get_text (atk_text); - - if (text == NULL) - return NULL; - - return _gtk_pango_get_text_after (gtk_text_get_layout (text), - boundary_type, offset, - start_offset, end_offset); -} - -static int -gtk_entry_accessible_get_character_count (AtkText *atk_text) -{ - GtkText *text; - char *display_text; - int char_count; - - text = get_text (atk_text); - - if (text == NULL) - return 0; - - display_text = gtk_text_get_display_text (text, 0, -1); - - char_count = 0; - if (display_text) - { - char_count = g_utf8_strlen (display_text, -1); - g_free (display_text); - } - - return char_count; -} - -static int -gtk_entry_accessible_get_caret_offset (AtkText *text) -{ - GtkWidget *widget; - gboolean result; - int cursor_position; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return -1; - - result = gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), NULL, &cursor_position); - if (!result) - return -1; - - return cursor_position; -} - -static gboolean -gtk_entry_accessible_set_caret_offset (AtkText *text, - int offset) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - gtk_editable_set_position (GTK_EDITABLE (widget), offset); - - return TRUE; -} - -static AtkAttributeSet * -add_text_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - int i) -{ - AtkAttribute *at; - - at = g_new (AtkAttribute, 1); - at->name = g_strdup (atk_text_attribute_get_name (attr)); - at->value = g_strdup (atk_text_attribute_get_value (attr, i)); - - return g_slist_prepend (attributes, at); -} - -static AtkAttributeSet * -gtk_entry_accessible_get_run_attributes (AtkText *atk_text, - int offset, - int *start_offset, - int *end_offset) -{ - GtkText *text; - AtkAttributeSet *attributes; - - text = get_text (atk_text); - - if (text == NULL) - return NULL; - - attributes = NULL; - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (GTK_WIDGET (text))); - attributes = _gtk_pango_get_run_attributes (attributes, - gtk_text_get_layout (text), - offset, - start_offset, - end_offset); - - return attributes; -} - -static AtkAttributeSet * -gtk_entry_accessible_get_default_attributes (AtkText *atk_text) -{ - GtkText *text; - AtkAttributeSet *attributes; - - text = get_text (atk_text); - - if (text == NULL) - return NULL; - - attributes = NULL; - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (GTK_WIDGET (text))); - attributes = _gtk_pango_get_default_attributes (attributes, - gtk_text_get_layout (text)); - attributes = _gtk_style_context_get_attributes (attributes, - gtk_widget_get_style_context (GTK_WIDGET (text))); - - return attributes; -} - -static void -gtk_entry_accessible_get_character_extents (AtkText *atk_text, - int offset, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coords) -{ - GtkText *textw; - PangoRectangle char_rect; - char *entry_text; - int index, x_layout, y_layout; - GtkAllocation allocation; - - textw = get_text (atk_text); - - if (textw == NULL) - return; - - gtk_text_get_layout_offsets (textw, &x_layout, &y_layout); - entry_text = gtk_text_get_display_text (textw, 0, -1); - index = g_utf8_offset_to_pointer (entry_text, offset) - entry_text; - g_free (entry_text); - - pango_layout_index_to_pos (gtk_text_get_layout (textw), index, &char_rect); - pango_extents_to_pixels (&char_rect, NULL); - - gtk_widget_get_allocation (GTK_WIDGET (textw), &allocation); - - *x = allocation.x + x_layout + char_rect.x; - *y = allocation.y + y_layout + char_rect.y; - *width = char_rect.width; - *height = char_rect.height; -} - -static int -gtk_entry_accessible_get_offset_at_point (AtkText *atk_text, - int x, - int y, - AtkCoordType coords) -{ - GtkText *textw; - char *text; - int index, x_layout, y_layout; - int x_local, y_local; - glong offset; - - textw = get_text (atk_text); - - if (textw == NULL) - return 1; - - gtk_text_get_layout_offsets (textw, &x_layout, &y_layout); - - x_local = x - x_layout; - y_local = y - y_layout; - - if (!pango_layout_xy_to_index (gtk_text_get_layout (textw), - x_local * PANGO_SCALE, - y_local * PANGO_SCALE, - &index, NULL)) - { - if (x_local < 0 || y_local < 0) - index = 0; - else - index = -1; - } - - offset = -1; - if (index != -1) - { - text = gtk_text_get_display_text (textw, 0, -1); - offset = g_utf8_pointer_to_offset (text, text + index); - g_free (text); - } - - return offset; -} - -static int -gtk_entry_accessible_get_n_selections (AtkText *text) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return 0; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - return 1; - - return 0; -} - -static char * -gtk_entry_accessible_get_selection (AtkText *text, - int selection_num, - int *start_pos, - int *end_pos) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - if (selection_num != 0) - return NULL; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), start_pos, end_pos)) - return gtk_editable_get_chars (GTK_EDITABLE (widget), *start_pos, *end_pos); - - return NULL; -} - -static gboolean -gtk_entry_accessible_add_selection (AtkText *text, - int start_pos, - int end_pos) -{ - GtkEntry *entry; - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - entry = GTK_ENTRY (widget); - - if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (entry), start_pos, end_pos); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_entry_accessible_remove_selection (AtkText *text, - int selection_num) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (widget), end, end); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_entry_accessible_set_selection (AtkText *text, - int selection_num, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (widget), start_pos, end_pos); - return TRUE; - } - else - return FALSE; -} - -static gunichar -gtk_entry_accessible_get_character_at_offset (AtkText *atk_text, - int offset) -{ - GtkText *textw; - char *text; - char *index; - gunichar result; - - result = '\0'; - - textw = get_text (atk_text); - - if (textw == NULL) - return 0; - - if (!gtk_text_get_visibility (textw)) - return result; - - text = gtk_text_get_display_text (textw, 0, -1); - if (offset < g_utf8_strlen (text, -1)) - { - index = g_utf8_offset_to_pointer (text, offset); - result = g_utf8_get_char (index); - g_free (text); - } - - return result; -} - -static void -atk_text_interface_init (AtkTextIface *iface) -{ - iface->get_text = gtk_entry_accessible_get_text; - iface->get_character_at_offset = gtk_entry_accessible_get_character_at_offset; - iface->get_text_before_offset = gtk_entry_accessible_get_text_before_offset; - iface->get_text_at_offset = gtk_entry_accessible_get_text_at_offset; - iface->get_text_after_offset = gtk_entry_accessible_get_text_after_offset; - iface->get_caret_offset = gtk_entry_accessible_get_caret_offset; - iface->set_caret_offset = gtk_entry_accessible_set_caret_offset; - iface->get_character_count = gtk_entry_accessible_get_character_count; - iface->get_n_selections = gtk_entry_accessible_get_n_selections; - iface->get_selection = gtk_entry_accessible_get_selection; - iface->add_selection = gtk_entry_accessible_add_selection; - iface->remove_selection = gtk_entry_accessible_remove_selection; - iface->set_selection = gtk_entry_accessible_set_selection; - iface->get_run_attributes = gtk_entry_accessible_get_run_attributes; - iface->get_default_attributes = gtk_entry_accessible_get_default_attributes; - iface->get_character_extents = gtk_entry_accessible_get_character_extents; - iface->get_offset_at_point = gtk_entry_accessible_get_offset_at_point; -} - -static void -gtk_entry_accessible_set_text_contents (AtkEditableText *text, - const char *string) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - if (!gtk_editable_get_editable (GTK_EDITABLE (widget))) - return; - - gtk_editable_set_text (GTK_EDITABLE (widget), string); -} - -static void -gtk_entry_accessible_insert_text (AtkEditableText *text, - const char *string, - int length, - int *position) -{ - GtkWidget *widget; - GtkEditable *editable; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - gtk_editable_insert_text (editable, string, length, position); - gtk_editable_set_position (editable, *position); -} - -static void -gtk_entry_accessible_copy_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - char *str; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - str = gtk_editable_get_chars (editable, start_pos, end_pos); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_set_text (clipboard, str); - g_free (str); -} - -static void -gtk_entry_accessible_cut_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - char *str; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - str = gtk_editable_get_chars (editable, start_pos, end_pos); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_set_text (clipboard, str); - gtk_editable_delete_text (editable, start_pos, end_pos); -} - -static void -gtk_entry_accessible_delete_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - gtk_editable_delete_text (editable, start_pos, end_pos); -} - -typedef struct -{ - GtkEntry* entry; - int position; -} PasteData; - -static void -paste_received_cb (GObject *clipboard, - GAsyncResult *result, - gpointer data) -{ - PasteData *paste = data; - char *text; - - text = gdk_clipboard_read_text_finish (GDK_CLIPBOARD (clipboard), result, NULL); - if (text) - gtk_editable_insert_text (GTK_EDITABLE (paste->entry), text, -1, - &paste->position); - - g_object_unref (paste->entry); - g_free (paste); - g_free (text); -} - -static void -gtk_entry_accessible_paste_text (AtkEditableText *text, - int position) -{ - GtkWidget *widget; - GtkEditable *editable; - PasteData *paste; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - paste = g_new0 (PasteData, 1); - paste->entry = GTK_ENTRY (widget); - paste->position = position; - - g_object_ref (paste->entry); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_read_text_async (clipboard, NULL, paste_received_cb, paste); -} - -static void -atk_editable_text_interface_init (AtkEditableTextIface *iface) -{ - iface->set_text_contents = gtk_entry_accessible_set_text_contents; - iface->insert_text = gtk_entry_accessible_insert_text; - iface->copy_text = gtk_entry_accessible_copy_text; - iface->cut_text = gtk_entry_accessible_cut_text; - iface->delete_text = gtk_entry_accessible_delete_text; - iface->paste_text = gtk_entry_accessible_paste_text; - iface->set_run_attributes = NULL; -} - -static gboolean -gtk_entry_accessible_do_action (AtkAction *action, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - if (i != 0) - return FALSE; - - gtk_widget_activate (widget); - - return TRUE; -} - -static int -gtk_entry_accessible_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_entry_accessible_get_keybinding (AtkAction *action, - int i) -{ - GtkWidget *widget; - GtkWidget *label; - AtkRelationSet *set; - AtkRelation *relation; - GPtrArray *target; - gpointer target_object; - guint key_val; - - if (i != 0) - return NULL; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return NULL; - - set = atk_object_ref_relation_set (ATK_OBJECT (action)); - if (!set) - return NULL; - - label = NULL; - relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY); - if (relation) - { - target = atk_relation_get_target (relation); - - target_object = g_ptr_array_index (target, 0); - label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object)); - } - - g_object_unref (set); - - if (GTK_IS_LABEL (label)) - { - key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); - if (key_val != GDK_KEY_VoidSymbol) - return gtk_accelerator_name (key_val, GDK_ALT_MASK); - } - - return NULL; -} - -static const char * -gtk_entry_accessible_action_get_name (AtkAction *action, - int i) -{ - if (i == 0) - return "activate"; - return NULL; -} - -static const char * -gtk_entry_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Activate"); - return NULL; -} - -static const char * -gtk_entry_accessible_action_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Activates the entry"); - return NULL; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_entry_accessible_do_action; - iface->get_n_actions = gtk_entry_accessible_get_n_actions; - iface->get_keybinding = gtk_entry_accessible_get_keybinding; - iface->get_name = gtk_entry_accessible_action_get_name; - iface->get_localized_name = gtk_entry_accessible_action_get_localized_name; - iface->get_description = gtk_entry_accessible_action_get_description; -} diff --git a/gtk/a11y/gtkentryaccessible.h b/gtk/a11y/gtkentryaccessible.h deleted file mode 100644 index 7b1b5b787d..0000000000 --- a/gtk/a11y/gtkentryaccessible.h +++ /dev/null @@ -1,60 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_ENTRY_ACCESSIBLE_H__ -#define __GTK_ENTRY_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_ENTRY_ACCESSIBLE (gtk_entry_accessible_get_type ()) -#define GTK_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_ACCESSIBLE, GtkEntryAccessible)) -#define GTK_ENTRY_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY_ACCESSIBLE, GtkEntryAccessibleClass)) -#define GTK_IS_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_ACCESSIBLE)) -#define GTK_IS_ENTRY_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY_ACCESSIBLE)) -#define GTK_ENTRY_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY_ACCESSIBLE, GtkEntryAccessibleClass)) - -typedef struct _GtkEntryAccessible GtkEntryAccessible; -typedef struct _GtkEntryAccessibleClass GtkEntryAccessibleClass; -typedef struct _GtkEntryAccessiblePrivate GtkEntryAccessiblePrivate; - -struct _GtkEntryAccessible -{ - GtkWidgetAccessible parent; - - GtkEntryAccessiblePrivate *priv; -}; - -struct _GtkEntryAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_entry_accessible_get_type (void); - -GDK_AVAILABLE_IN_ALL -GType gtk_entry_icon_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_ENTRY_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkexpanderaccessible.c b/gtk/a11y/gtkexpanderaccessible.c deleted file mode 100644 index 1610363beb..0000000000 --- a/gtk/a11y/gtkexpanderaccessible.c +++ /dev/null @@ -1,251 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkexpanderaccessibleprivate.h" - -#include <glib/gi18n-lib.h> -#include <gtk/gtk.h> - -static void atk_action_interface_init (AtkActionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkExpanderAccessible, gtk_expander_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - -static const char * -gtk_expander_accessible_get_full_text (GtkExpander *widget) -{ - GtkWidget *label_widget; - - label_widget = gtk_expander_get_label_widget (widget); - - if (!GTK_IS_LABEL (label_widget)) - return NULL; - - return gtk_label_get_text (GTK_LABEL (label_widget)); -} - -static const char * -gtk_expander_accessible_get_name (AtkObject *obj) -{ - GtkWidget *widget; - const char *name; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - name = ATK_OBJECT_CLASS (gtk_expander_accessible_parent_class)->get_name (obj); - if (name != NULL) - return name; - - return gtk_expander_accessible_get_full_text (GTK_EXPANDER (widget)); -} - -static int -gtk_expander_accessible_get_n_children (AtkObject *obj) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return 0; - - if (gtk_expander_get_child (GTK_EXPANDER (widget))) - return 1; - - return 0; -} - -static AtkObject * -gtk_expander_accessible_ref_child (AtkObject *obj, - int i) -{ - AtkObject *accessible; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - widget = gtk_expander_get_child (GTK_EXPANDER (widget)); - if (widget == NULL) - return NULL; - - accessible = gtk_widget_get_accessible (widget); - g_object_ref (accessible); - return accessible; -} - -void -gtk_expander_accessible_update_label (GtkExpanderAccessible *self) -{ - AtkObject *atk_obj = ATK_OBJECT (self); - - if (atk_obj->name == NULL) - g_object_notify (G_OBJECT (atk_obj), "accessible-name"); - - g_signal_emit_by_name (atk_obj, "visible-data-changed"); -} - -void -gtk_expander_accessible_update_state (GtkExpanderAccessible *self, - gboolean expanded) -{ - AtkObject *atk_obj = ATK_OBJECT (self); - - atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED, expanded); - atk_object_notify_state_change (atk_obj, ATK_STATE_EXPANDED, expanded); - - g_signal_emit_by_name (atk_obj, "visible-data-changed"); -} - -static AtkStateSet * -gtk_expander_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget; - GtkExpander *expander; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - state_set = ATK_OBJECT_CLASS (gtk_expander_accessible_parent_class)->ref_state_set (obj); - - expander = GTK_EXPANDER (widget); - - atk_state_set_add_state (state_set, ATK_STATE_EXPANDABLE); - - if (gtk_expander_get_expanded (expander)) - { - atk_state_set_add_state (state_set, ATK_STATE_CHECKED); - atk_state_set_add_state (state_set, ATK_STATE_EXPANDED); - } - - return state_set; -} - -static void -gtk_expander_accessible_class_init (GtkExpanderAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_name = gtk_expander_accessible_get_name; - class->get_n_children = gtk_expander_accessible_get_n_children; - class->ref_child = gtk_expander_accessible_ref_child; - class->ref_state_set = gtk_expander_accessible_ref_state_set; -} - -static void -gtk_expander_accessible_init (GtkExpanderAccessible *self) -{ - ATK_OBJECT (self)->role = ATK_ROLE_TOGGLE_BUTTON; -} - -static gboolean -gtk_expander_accessible_do_action (AtkAction *action, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - if (i != 0) - return FALSE; - - gtk_widget_activate (widget); - return TRUE; -} - -static int -gtk_expander_accessible_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_expander_accessible_get_keybinding (AtkAction *action, - int i) -{ - char *return_value = NULL; - GtkWidget *widget; - GtkWidget *label; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return NULL; - - if (i != 0) - return NULL; - - label = gtk_expander_get_label_widget (GTK_EXPANDER (widget)); - if (GTK_IS_LABEL (label)) - { - guint key_val; - - key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); - if (key_val != GDK_KEY_VoidSymbol) - return_value = gtk_accelerator_name (key_val, GDK_ALT_MASK); - } - - return return_value; -} - -static const char * -gtk_expander_accessible_action_get_name (AtkAction *action, - int i) -{ - if (i == 0) - return "activate"; - return NULL; -} - -static const char * -gtk_expander_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Activate"); - return NULL; -} - -static const char * -gtk_expander_accessible_action_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Activates the expander"); - return NULL; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_expander_accessible_do_action; - iface->get_n_actions = gtk_expander_accessible_get_n_actions; - iface->get_keybinding = gtk_expander_accessible_get_keybinding; - iface->get_name = gtk_expander_accessible_action_get_name; - iface->get_localized_name = gtk_expander_accessible_action_get_localized_name; - iface->get_description = gtk_expander_accessible_action_get_description; -} diff --git a/gtk/a11y/gtkexpanderaccessible.h b/gtk/a11y/gtkexpanderaccessible.h deleted file mode 100644 index ecad612efe..0000000000 --- a/gtk/a11y/gtkexpanderaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2003 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_EXPANDER_ACCESSIBLE_H__ -#define __GTK_EXPANDER_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_EXPANDER_ACCESSIBLE (gtk_expander_accessible_get_type ()) -#define GTK_EXPANDER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_EXPANDER_ACCESSIBLE, GtkExpanderAccessible)) -#define GTK_EXPANDER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_EXPANDER_ACCESSIBLE, GtkExpanderAccessibleClass)) -#define GTK_IS_EXPANDER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_EXPANDER_ACCESSIBLE)) -#define GTK_IS_EXPANDER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_EXPANDER_ACCESSIBLE)) -#define GTK_EXPANDER_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_EXPANDER_ACCESSIBLE, GtkExpanderAccessibleClass)) - -typedef struct _GtkExpanderAccessible GtkExpanderAccessible; -typedef struct _GtkExpanderAccessibleClass GtkExpanderAccessibleClass; -typedef struct _GtkExpanderAccessiblePrivate GtkExpanderAccessiblePrivate; - -struct _GtkExpanderAccessible -{ - GtkWidgetAccessible parent; - - GtkExpanderAccessiblePrivate *priv; -}; - -struct _GtkExpanderAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_expander_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_EXPANDER_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkexpanderaccessibleprivate.h b/gtk/a11y/gtkexpanderaccessibleprivate.h deleted file mode 100644 index aab9ee5e5e..0000000000 --- a/gtk/a11y/gtkexpanderaccessibleprivate.h +++ /dev/null @@ -1,31 +0,0 @@ -/* gtkexpanderaccessibleprivate.h: GtkExpanderAccessible private API - * - * 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/>. - */ - -#pragma once - -#include "gtkexpanderaccessible.h" - -G_BEGIN_DECLS - -void gtk_expander_accessible_update_label (GtkExpanderAccessible *self); -void gtk_expander_accessible_update_state (GtkExpanderAccessible *self, - gboolean expanded); - -G_END_DECLS diff --git a/gtk/a11y/gtkflowboxaccessible.c b/gtk/a11y/gtkflowboxaccessible.c deleted file mode 100644 index 4b0a07d5f8..0000000000 --- a/gtk/a11y/gtkflowboxaccessible.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkflowboxaccessibleprivate.h" - -#include "gtk/gtkflowbox.h" - -static void atk_selection_interface_init (AtkSelectionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkFlowBoxAccessible, gtk_flow_box_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) - -static void -gtk_flow_box_accessible_init (GtkFlowBoxAccessible *accessible) -{ -} - -static void -gtk_flow_box_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_flow_box_accessible_parent_class)->initialize (obj, data); - - obj->role = ATK_ROLE_TABLE; -} - -static AtkStateSet* -gtk_flow_box_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - state_set = ATK_OBJECT_CLASS (gtk_flow_box_accessible_parent_class)->ref_state_set (obj); - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - - if (widget != NULL) - atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS); - - return state_set; -} - -static void -gtk_flow_box_accessible_class_init (GtkFlowBoxAccessibleClass *klass) -{ - AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass); - - object_class->initialize = gtk_flow_box_accessible_initialize; - object_class->ref_state_set = gtk_flow_box_accessible_ref_state_set; -} - -static gboolean -gtk_flow_box_accessible_add_selection (AtkSelection *selection, - int idx) -{ - GtkWidget *box; - GtkWidget *child; - int pos; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - for (child = gtk_widget_get_first_child (box), pos = 0; - child != NULL && pos < idx; - child = gtk_widget_get_next_sibling (child), pos++) ; - - if (child && pos == idx) - { - gtk_flow_box_select_child (GTK_FLOW_BOX (box), GTK_FLOW_BOX_CHILD (child)); - return TRUE; - } - - return FALSE; -} - -static gboolean -gtk_flow_box_accessible_remove_selection (AtkSelection *selection, - int idx) -{ - GtkWidget *box; - GtkWidget *child; - int pos; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - for (child = gtk_widget_get_first_child (box), pos = 0; - child != NULL && pos < idx; - child = gtk_widget_get_next_sibling (child), pos++) ; - - if (child && pos == idx) - { - gtk_flow_box_unselect_child (GTK_FLOW_BOX (box), GTK_FLOW_BOX_CHILD (child)); - return TRUE; - } - - return FALSE; -} - -static gboolean -gtk_flow_box_accessible_clear_selection (AtkSelection *selection) -{ - GtkWidget *box; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - gtk_flow_box_unselect_all (GTK_FLOW_BOX (box)); - return TRUE; -} - -static gboolean -gtk_flow_box_accessible_select_all (AtkSelection *selection) -{ - GtkWidget *box; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - gtk_flow_box_select_all (GTK_FLOW_BOX (box)); - return TRUE; -} - -typedef struct -{ - int idx; - GtkWidget *child; -} FindSelectedData; - -static void -find_selected_child (GtkFlowBox *box, - GtkFlowBoxChild *child, - gpointer data) -{ - FindSelectedData *d = data; - - if (d->idx == 0) - { - if (d->child == NULL) - d->child = GTK_WIDGET (child); - } - else - d->idx -= 1; -} - -static AtkObject * -gtk_flow_box_accessible_ref_selection (AtkSelection *selection, - int idx) -{ - GtkWidget *box; - AtkObject *accessible; - FindSelectedData data; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return NULL; - - data.idx = idx; - data.child = NULL; - gtk_flow_box_selected_foreach (GTK_FLOW_BOX (box), find_selected_child, &data); - - if (data.child == NULL) - return NULL; - - accessible = gtk_widget_get_accessible (data.child); - g_object_ref (accessible); - return accessible; -} - -static void -count_selected (GtkFlowBox *box, - GtkFlowBoxChild *child, - gpointer data) -{ - int *count = data; - *count += 1; -} - -static int -gtk_flow_box_accessible_get_selection_count (AtkSelection *selection) -{ - GtkWidget *box; - int count; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return 0; - - count = 0; - gtk_flow_box_selected_foreach (GTK_FLOW_BOX (box), count_selected, &count); - - return count; -} - -static gboolean -gtk_flow_box_accessible_is_child_selected (AtkSelection *selection, - int idx) -{ - GtkWidget *box; - GtkFlowBoxChild *child; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - child = gtk_flow_box_get_child_at_index (GTK_FLOW_BOX (box), idx); - - return gtk_flow_box_child_is_selected (child); -} - -static void atk_selection_interface_init (AtkSelectionIface *iface) -{ - iface->add_selection = gtk_flow_box_accessible_add_selection; - iface->remove_selection = gtk_flow_box_accessible_remove_selection; - iface->clear_selection = gtk_flow_box_accessible_clear_selection; - iface->ref_selection = gtk_flow_box_accessible_ref_selection; - iface->get_selection_count = gtk_flow_box_accessible_get_selection_count; - iface->is_child_selected = gtk_flow_box_accessible_is_child_selected; - iface->select_all_selection = gtk_flow_box_accessible_select_all; -} - -void -_gtk_flow_box_accessible_selection_changed (GtkWidget *box) -{ - AtkObject *accessible; - accessible = gtk_widget_get_accessible (box); - g_signal_emit_by_name (accessible, "selection-changed"); -} - -void -_gtk_flow_box_accessible_update_cursor (GtkWidget *box, - GtkWidget *child) -{ - AtkObject *accessible; - AtkObject *descendant; - accessible = gtk_widget_get_accessible (box); - descendant = child ? gtk_widget_get_accessible (child) : NULL; - g_signal_emit_by_name (accessible, "active-descendant-changed", descendant); -} diff --git a/gtk/a11y/gtkflowboxaccessible.h b/gtk/a11y/gtkflowboxaccessible.h deleted file mode 100644 index 8a5f8376c1..0000000000 --- a/gtk/a11y/gtkflowboxaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#ifndef __GTK_FLOW_BOX_ACCESSIBLE_H__ -#define __GTK_FLOW_BOX_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_FLOW_BOX_ACCESSIBLE (gtk_flow_box_accessible_get_type ()) -#define GTK_FLOW_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FLOW_BOX_ACCESSIBLE, GtkFlowBoxAccessible)) -#define GTK_FLOW_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FLOW_BOX_ACCESSIBLE, GtkFlowBoxAccessibleClass)) -#define GTK_IS_FLOW_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FLOW_BOX_ACCESSIBLE)) -#define GTK_IS_FLOW_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FLOW_BOX_ACCESSIBLE)) -#define GTK_FLOW_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FLOW_BOX_ACCESSIBLE, GtkFlowBoxAccessibleClass)) - -typedef struct _GtkFlowBoxAccessible GtkFlowBoxAccessible; -typedef struct _GtkFlowBoxAccessibleClass GtkFlowBoxAccessibleClass; -typedef struct _GtkFlowBoxAccessiblePrivate GtkFlowBoxAccessiblePrivate; - -struct _GtkFlowBoxAccessible -{ - GtkWidgetAccessible parent; - - GtkFlowBoxAccessiblePrivate *priv; -}; - -struct _GtkFlowBoxAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_flow_box_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_FLOW_BOX_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkflowboxaccessibleprivate.h b/gtk/a11y/gtkflowboxaccessibleprivate.h deleted file mode 100644 index df19ba782a..0000000000 --- a/gtk/a11y/gtkflowboxaccessibleprivate.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#ifndef __GTK_FLOW_BOX_ACCESSIBLE_PRIVATE_H__ -#define __GTK_FLOW_BOX_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtkflowboxaccessible.h> - -G_BEGIN_DECLS - -void _gtk_flow_box_accessible_selection_changed (GtkWidget *box); -void _gtk_flow_box_accessible_update_cursor (GtkWidget *box, - GtkWidget *child); -G_END_DECLS - -#endif /* __GTK_FLOW_BOX_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtkflowboxchildaccessible.c b/gtk/a11y/gtkflowboxchildaccessible.c deleted file mode 100644 index 794c4f5ee3..0000000000 --- a/gtk/a11y/gtkflowboxchildaccessible.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkflowboxchildaccessible.h" - -#include "gtk/gtkflowbox.h" - - -G_DEFINE_TYPE (GtkFlowBoxChildAccessible, gtk_flow_box_child_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static void -gtk_flow_box_child_accessible_init (GtkFlowBoxChildAccessible *accessible) -{ -} - -static void -gtk_flow_box_child_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_flow_box_child_accessible_parent_class)->initialize (obj, data); - - obj->role = ATK_ROLE_TABLE_CELL; -} - -static AtkStateSet * -gtk_flow_box_child_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget, *parent; - - state_set = ATK_OBJECT_CLASS (gtk_flow_box_child_accessible_parent_class)->ref_state_set (obj); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget != NULL) - { - parent = gtk_widget_get_parent (widget); - if (gtk_flow_box_get_selection_mode (GTK_FLOW_BOX (parent)) != GTK_SELECTION_NONE) - atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE); - - if (gtk_flow_box_child_is_selected (GTK_FLOW_BOX_CHILD (widget))) - atk_state_set_add_state (state_set, ATK_STATE_SELECTED); - } - - return state_set; -} - -static void -gtk_flow_box_child_accessible_class_init (GtkFlowBoxChildAccessibleClass *klass) -{ - AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass); - - object_class->initialize = gtk_flow_box_child_accessible_initialize; - object_class->ref_state_set = gtk_flow_box_child_accessible_ref_state_set; -} diff --git a/gtk/a11y/gtkflowboxchildaccessible.h b/gtk/a11y/gtkflowboxchildaccessible.h deleted file mode 100644 index c010ffe25d..0000000000 --- a/gtk/a11y/gtkflowboxchildaccessible.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#ifndef __GTK_FLOW_BOX_CHILD_ACCESSIBLE_H__ -#define __GTK_FLOW_BOX_CHILD_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE (gtk_flow_box_child_accessible_get_type ()) -#define GTK_FLOW_BOX_CHILD_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE, GtkFlowBoxChildAccessible)) -#define GTK_FLOW_BOX_CHILD_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE, GtkFlowBoxChildAccessibleClass)) -#define GTK_IS_FLOW_BOX_CHILD_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE)) -#define GTK_IS_FLOW_BOX_CHILD_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE)) -#define GTK_FLOW_BOX_CHILD_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE, GtkFlowBoxChildAccessibleClass)) - -typedef struct _GtkFlowBoxChildAccessible GtkFlowBoxChildAccessible; -typedef struct _GtkFlowBoxChildAccessibleClass GtkFlowBoxChildAccessibleClass; - -struct _GtkFlowBoxChildAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkFlowBoxChildAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_flow_box_child_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_FLOW_BOX_CHILD_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkframeaccessible.c b/gtk/a11y/gtkframeaccessible.c deleted file mode 100644 index 7c59bb237f..0000000000 --- a/gtk/a11y/gtkframeaccessible.c +++ /dev/null @@ -1,65 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtkframeaccessible.h" - - -G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static void -gtk_frame_accessible_initialize (AtkObject *accessible, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->initialize (accessible, data); - - accessible->role = ATK_ROLE_PANEL; -} - -static const char * -gtk_frame_accessible_get_name (AtkObject *obj) -{ - const char *name; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - name = ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->get_name (obj); - if (name != NULL) - return name; - - return gtk_frame_get_label (GTK_FRAME (widget)); -} - -static void -gtk_frame_accessible_class_init (GtkFrameAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->initialize = gtk_frame_accessible_initialize; - class->get_name = gtk_frame_accessible_get_name; -} - -static void -gtk_frame_accessible_init (GtkFrameAccessible *frame) -{ -} diff --git a/gtk/a11y/gtkframeaccessible.h b/gtk/a11y/gtkframeaccessible.h deleted file mode 100644 index a2cbb59c6e..0000000000 --- a/gtk/a11y/gtkframeaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_FRAME_ACCESSIBLE_H__ -#define __GTK_FRAME_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_FRAME_ACCESSIBLE (gtk_frame_accessible_get_type ()) -#define GTK_FRAME_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessible)) -#define GTK_FRAME_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessibleClass)) -#define GTK_IS_FRAME_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FRAME_ACCESSIBLE)) -#define GTK_IS_FRAME_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FRAME_ACCESSIBLE)) -#define GTK_FRAME_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessibleClass)) - -typedef struct _GtkFrameAccessible GtkFrameAccessible; -typedef struct _GtkFrameAccessibleClass GtkFrameAccessibleClass; -typedef struct _GtkFrameAccessiblePrivate GtkFrameAccessiblePrivate; - -struct _GtkFrameAccessible -{ - GtkWidgetAccessible parent; - - GtkFrameAccessiblePrivate *priv; -}; - -struct _GtkFrameAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_frame_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_FRAME_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkiconviewaccessible.c b/gtk/a11y/gtkiconviewaccessible.c deleted file mode 100644 index ded31c5e2b..0000000000 --- a/gtk/a11y/gtkiconviewaccessible.c +++ /dev/null @@ -1,1540 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "config.h" - -#include "gtkiconviewaccessibleprivate.h" - -#include <string.h> - -#include "gtk/gtkadjustment.h" -#include "gtk/gtkiconviewprivate.h" -#include "gtk/gtkcellrendererpixbuf.h" -#include "gtk/gtkcellrenderertext.h" -#include "gtk/gtkpango.h" -#include "gtk/gtkwidgetprivate.h" - -#define GTK_TYPE_ICON_VIEW_ITEM_ACCESSIBLE (_gtk_icon_view_item_accessible_get_type ()) -#define GTK_ICON_VIEW_ITEM_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW_ITEM_ACCESSIBLE, GtkIconViewItemAccessible)) -#define GTK_IS_ICON_VIEW_ITEM_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW_ITEM_ACCESSIBLE)) - -typedef struct -{ - GList *items; - GtkTreeModel *model; -} GtkIconViewAccessiblePrivate; - -typedef struct -{ - AtkObject parent; - - GtkIconViewItem *item; - GtkWidget *widget; - AtkStateSet *state_set; - char *text; - char *action_description; - char *image_description; - guint action_idle_handler; -} GtkIconViewItemAccessible; - -typedef struct -{ - AtkObjectClass parent_class; - -} GtkIconViewItemAccessibleClass; - -GType _gtk_icon_view_item_accessible_get_type (void); - -static gboolean gtk_icon_view_item_accessible_is_showing (GtkIconViewItemAccessible *item); - -static void atk_component_item_interface_init (AtkComponentIface *iface); -static void atk_action_item_interface_init (AtkActionIface *iface); -static void atk_text_item_interface_init (AtkTextIface *iface); -static void atk_image_item_interface_init (AtkImageIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkIconViewItemAccessible, _gtk_icon_view_item_accessible, ATK_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_item_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_item_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_item_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_item_interface_init)) - - -static gboolean -idle_do_action (gpointer data) -{ - GtkIconViewItemAccessible *item; - GtkIconView *icon_view; - GtkTreePath *path; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (data); - item->action_idle_handler = 0; - - if (item->widget != NULL) - { - icon_view = GTK_ICON_VIEW (item->widget); - path = gtk_tree_path_new_from_indices (item->item->index, -1); - gtk_icon_view_item_activated (icon_view, path); - gtk_tree_path_free (path); - } - - return FALSE; -} - -static gboolean -gtk_icon_view_item_accessible_do_action (AtkAction *action, - int i) -{ - GtkIconViewItemAccessible *item; - - if (i != 0) - return FALSE; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action); - - if (!GTK_IS_ICON_VIEW (item->widget)) - return FALSE; - - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return FALSE; - - if (!item->action_idle_handler) - { - item->action_idle_handler = g_idle_add (idle_do_action, item); - g_source_set_name_by_id (item->action_idle_handler, "[gtk] idle_do_action"); - } - - return TRUE; -} - -static int -gtk_icon_view_item_accessible_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_icon_view_item_accessible_get_description (AtkAction *action, - int i) -{ - GtkIconViewItemAccessible *item; - - if (i != 0) - return NULL; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action); - - if (item->action_description) - return item->action_description; - else - return "Activate item"; -} - -static const char * -gtk_icon_view_item_accessible_get_name (AtkAction *action, - int i) -{ - if (i != 0) - return NULL; - - return "activate"; -} - -static gboolean -gtk_icon_view_item_accessible_set_description (AtkAction *action, - int i, - const char *description) -{ - GtkIconViewItemAccessible *item; - - if (i != 0) - return FALSE; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (action); - - g_free (item->action_description); - item->action_description = g_strdup (description); - - return TRUE; -} - -static void -atk_action_item_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_icon_view_item_accessible_do_action; - iface->set_description = gtk_icon_view_item_accessible_set_description; - iface->get_name = gtk_icon_view_item_accessible_get_name; - iface->get_n_actions = gtk_icon_view_item_accessible_get_n_actions; - iface->get_description = gtk_icon_view_item_accessible_get_description; -} - -static const char * -gtk_icon_view_item_accessible_get_image_description (AtkImage *image) -{ - GtkIconViewItemAccessible *item; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (image); - - return item->image_description; -} - -static gboolean -gtk_icon_view_item_accessible_set_image_description (AtkImage *image, - const char *description) -{ - GtkIconViewItemAccessible *item; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (image); - - g_free (item->image_description); - item->image_description = g_strdup (description); - - return TRUE; -} - -typedef struct { - GdkRectangle box; - gboolean pixbuf_found; -} GetPixbufBoxData; - -static gboolean -get_pixbuf_foreach (GtkCellRenderer *renderer, - const GdkRectangle *cell_area, - const GdkRectangle *cell_background, - GetPixbufBoxData *data) -{ - if (GTK_IS_CELL_RENDERER_PIXBUF (renderer)) - { - data->box = *cell_area; - data->pixbuf_found = TRUE; - } - return (data->pixbuf_found != FALSE); -} - -static gboolean -get_pixbuf_box (GtkIconView *icon_view, - GtkIconViewItem *item, - GdkRectangle *box) -{ - GetPixbufBoxData data = { { 0, }, FALSE }; - GtkCellAreaContext *context; - - context = g_ptr_array_index (icon_view->priv->row_contexts, item->row); - - _gtk_icon_view_set_cell_data (icon_view, item); - gtk_cell_area_foreach_alloc (icon_view->priv->cell_area, context, - GTK_WIDGET (icon_view), - &item->cell_area, &item->cell_area, - (GtkCellAllocCallback)get_pixbuf_foreach, &data); - - *box = data.box; - - return data.pixbuf_found; -} - -static gboolean -get_text_foreach (GtkCellRenderer *renderer, - char **text) -{ - if (GTK_IS_CELL_RENDERER_TEXT (renderer)) - { - g_object_get (renderer, "text", text, NULL); - return TRUE; - } - return FALSE; -} - -static char * -get_text (GtkIconView *icon_view, - GtkIconViewItem *item) -{ - char *text = NULL; - - _gtk_icon_view_set_cell_data (icon_view, item); - gtk_cell_area_foreach (icon_view->priv->cell_area, - (GtkCellCallback) get_text_foreach, - &text); - - return text; -} - -static void -gtk_icon_view_item_accessible_get_image_size (AtkImage *image, - int *width, - int *height) -{ - GtkIconViewItemAccessible *item; - GdkRectangle box; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (image); - - if (!GTK_IS_ICON_VIEW (item->widget)) - return; - - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return; - - *width = 0; - *height = 0; - - if (get_pixbuf_box (GTK_ICON_VIEW (item->widget), item->item, &box)) - { - *width = box.width; - *height = box.height; - } -} - -static void -gtk_icon_view_item_accessible_get_image_position (AtkImage *image, - int *x, - int *y, - AtkCoordType coord_type) -{ - GtkIconViewItemAccessible *item; - GdkRectangle box; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (image); - - if (!GTK_IS_ICON_VIEW (item->widget)) - return; - - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return; - - atk_component_get_extents (ATK_COMPONENT (image), x, y, NULL, NULL, - coord_type); - - if (get_pixbuf_box (GTK_ICON_VIEW (item->widget), item->item, &box)) - { - *x+= box.x - item->item->cell_area.x; - *y+= box.y - item->item->cell_area.y; - } - -} - -static void -atk_image_item_interface_init (AtkImageIface *iface) -{ - iface->get_image_description = gtk_icon_view_item_accessible_get_image_description; - iface->set_image_description = gtk_icon_view_item_accessible_set_image_description; - iface->get_image_size = gtk_icon_view_item_accessible_get_image_size; - iface->get_image_position = gtk_icon_view_item_accessible_get_image_position; -} - -static char * -gtk_icon_view_item_accessible_get_text (AtkText *text, - int start_pos, - int end_pos) -{ - GtkIconViewItemAccessible *item; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (text); - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return NULL; - - if (item->text) - return g_utf8_substring (item->text, start_pos, end_pos > -1 ? end_pos : g_utf8_strlen (item->text, -1)); - else - return g_strdup (""); -} - -static gunichar -gtk_icon_view_item_accessible_get_character_at_offset (AtkText *text, - int offset) -{ - GtkIconViewItemAccessible *item; - char *string; - char *index; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (text); - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return '\0'; - - string = item->text; - - if (!string) - return '\0'; - - if (offset >= g_utf8_strlen (string, -1)) - return '\0'; - - index = g_utf8_offset_to_pointer (string, offset); - - return g_utf8_get_char (index); -} - -static PangoLayout * -create_pango_layout (GtkIconViewItemAccessible *item) -{ - PangoLayout *layout; - - layout = gtk_widget_create_pango_layout (item->widget, item->text); - - return layout; -} - -static char * -gtk_icon_view_item_accessible_get_text_before_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkIconViewItemAccessible *item; - PangoLayout *layout; - char *text; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (atk_text); - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return NULL; - - layout = create_pango_layout (item); - text = _gtk_pango_get_text_before (layout, boundary_type, offset, start_offset, end_offset); - g_object_unref (layout); - - return text; -} - -static char * -gtk_icon_view_item_accessible_get_text_at_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkIconViewItemAccessible *item; - PangoLayout *layout; - char *text; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (atk_text); - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return NULL; - - layout = create_pango_layout (item); - text = _gtk_pango_get_text_at (layout, boundary_type, offset, start_offset, end_offset); - g_object_unref (layout); - - return text; -} - -static char * -gtk_icon_view_item_accessible_get_text_after_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkIconViewItemAccessible *item; - PangoLayout *layout; - char *text; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (atk_text); - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return NULL; - - layout = create_pango_layout (item); - text = _gtk_pango_get_text_after (layout, boundary_type, offset, start_offset, end_offset); - g_object_unref (layout); - - return text; -} - -static int -gtk_icon_view_item_accessible_get_character_count (AtkText *text) -{ - GtkIconViewItemAccessible *item; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (text); - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return 0; - - if (item->text) - return g_utf8_strlen (item->text, -1); - else - return 0; -} - -static void -gtk_icon_view_item_accessible_get_character_extents (AtkText *text, - int offset, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkIconViewItemAccessible *item; -#if 0 - GtkIconView *icon_view; - PangoRectangle char_rect; - const char *item_text; - int index; -#endif - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (text); - - if (!GTK_IS_ICON_VIEW (item->widget)) - return; - - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return; - -#if 0 - icon_view = GTK_ICON_VIEW (item->widget); - /* FIXME we probably have to use GailTextCell to salvage this */ - gtk_icon_view_update_item_text (icon_view, item->item); - item_text = pango_layout_get_text (icon_view->priv->layout); - index = g_utf8_offset_to_pointer (item_text, offset) - item_text; - pango_layout_index_to_pos (icon_view->priv->layout, index, &char_rect); - - atk_component_get_position (ATK_COMPONENT (text), x, y, coord_type); - *x += item->item->layout_x - item->item->x + char_rect.x / PANGO_SCALE; - /* Look at gtk_icon_view_paint_item() to see where the text is. */ - *x -= ((item->item->width - item->item->layout_width) / 2) + (MAX (item->item->pixbuf_width, icon_view->priv->item_width) - item->item->width) / 2, - *y += item->item->layout_y - item->item->y + char_rect.y / PANGO_SCALE; - *width = char_rect.width / PANGO_SCALE; - *height = char_rect.height / PANGO_SCALE; -#endif -} - -static int -gtk_icon_view_item_accessible_get_offset_at_point (AtkText *text, - int x, - int y, - AtkCoordType coord_type) -{ - GtkIconViewItemAccessible *item; - int offset = 0; -#if 0 - GtkIconView *icon_view; - const char *item_text; - int index; - int l_x, l_y; -#endif - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (text); - - if (!GTK_IS_ICON_VIEW (item->widget)) - return -1; - - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return -1; - -#if 0 - icon_view = GTK_ICON_VIEW (item->widget); - /* FIXME we probably have to use GailTextCell to salvage this */ - gtk_icon_view_update_item_text (icon_view, item->item); - atk_component_get_position (ATK_COMPONENT (text), &l_x, &l_y, coord_type); - x -= l_x + item->item->layout_x - item->item->x; - x += ((item->item->width - item->item->layout_width) / 2) + (MAX (item->item->pixbuf_width, icon_view->priv->item_width) - item->item->width) / 2, - y -= l_y + item->item->layout_y - item->item->y; - item_text = pango_layout_get_text (icon_view->priv->layout); - if (!pango_layout_xy_to_index (icon_view->priv->layout, - x * PANGO_SCALE, - y * PANGO_SCALE, - &index, NULL)) - { - if (x < 0 || y < 0) - index = 0; - else - index = -1; - } - if (index == -1) - offset = g_utf8_strlen (item_text, -1); - else - offset = g_utf8_pointer_to_offset (item_text, item_text + index); -#endif - return offset; -} - -static void -atk_text_item_interface_init (AtkTextIface *iface) -{ - iface->get_text = gtk_icon_view_item_accessible_get_text; - iface->get_character_at_offset = gtk_icon_view_item_accessible_get_character_at_offset; - iface->get_text_before_offset = gtk_icon_view_item_accessible_get_text_before_offset; - iface->get_text_at_offset = gtk_icon_view_item_accessible_get_text_at_offset; - iface->get_text_after_offset = gtk_icon_view_item_accessible_get_text_after_offset; - iface->get_character_count = gtk_icon_view_item_accessible_get_character_count; - iface->get_character_extents = gtk_icon_view_item_accessible_get_character_extents; - iface->get_offset_at_point = gtk_icon_view_item_accessible_get_offset_at_point; -} - -static void -gtk_icon_view_item_accessible_get_extents (AtkComponent *component, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkIconViewItemAccessible *item; - AtkObject *parent_obj; - int l_x, l_y; - - g_return_if_fail (GTK_IS_ICON_VIEW_ITEM_ACCESSIBLE (component)); - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (component); - if (!GTK_IS_WIDGET (item->widget)) - return; - - if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT)) - return; - - *width = item->item->cell_area.width; - *height = item->item->cell_area.height; - if (gtk_icon_view_item_accessible_is_showing (item)) - { - parent_obj = gtk_widget_get_accessible (item->widget); - atk_component_get_extents (ATK_COMPONENT (parent_obj), &l_x, &l_y, - NULL, NULL, coord_type); - *x = l_x + item->item->cell_area.x; - *y = l_y + item->item->cell_area.y; - } - else - { - *x = G_MININT; - *y = G_MININT; - } -} - -static gboolean -gtk_icon_view_item_accessible_grab_focus (AtkComponent *component) -{ - GtkIconViewItemAccessible *item; - - g_return_val_if_fail (GTK_IS_ICON_VIEW_ITEM_ACCESSIBLE (component), FALSE); - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (component); - if (!GTK_IS_WIDGET (item->widget)) - return FALSE; - - gtk_widget_grab_focus (item->widget); - _gtk_icon_view_set_cursor_item (GTK_ICON_VIEW (item->widget), item->item, NULL); - - return TRUE; -} - -static void -atk_component_item_interface_init (AtkComponentIface *iface) -{ - iface->get_extents = gtk_icon_view_item_accessible_get_extents; - iface->grab_focus = gtk_icon_view_item_accessible_grab_focus; -} - -static gboolean -gtk_icon_view_item_accessible_add_state (GtkIconViewItemAccessible *item, - AtkStateType state_type, - gboolean emit_signal) -{ - gboolean rc; - - rc = atk_state_set_add_state (item->state_set, state_type); - - /* The signal should only be generated if the value changed, - * not when the item is set up. So states that are set - * initially should pass FALSE as the emit_signal argument. - */ - if (emit_signal) - { - atk_object_notify_state_change (ATK_OBJECT (item), state_type, TRUE); - /* If state_type is ATK_STATE_VISIBLE, additional notification */ - if (state_type == ATK_STATE_VISIBLE) - g_signal_emit_by_name (item, "visible-data-changed"); - } - - return rc; -} - -static gboolean -gtk_icon_view_item_accessible_remove_state (GtkIconViewItemAccessible *item, - AtkStateType state_type, - gboolean emit_signal) -{ - if (atk_state_set_contains_state (item->state_set, state_type)) - { - gboolean rc; - - rc = atk_state_set_remove_state (item->state_set, state_type); - - /* The signal should only be generated if the value changed, - * not when the item is set up. So states that are set - * initially should pass FALSE as the emit_signal argument. - */ - if (emit_signal) - { - atk_object_notify_state_change (ATK_OBJECT (item), state_type, FALSE); - /* If state_type is ATK_STATE_VISIBLE, additional notification */ - if (state_type == ATK_STATE_VISIBLE) - g_signal_emit_by_name (item, "visible-data-changed"); - } - - return rc; - } - else - return FALSE; -} - -static gboolean -gtk_icon_view_item_accessible_is_showing (GtkIconViewItemAccessible *item) -{ - GtkAllocation allocation; - GtkIconView *icon_view; - GdkRectangle visible_rect; - gboolean is_showing; - - /* An item is considered "SHOWING" if any part of the item - * is in the visible rectangle. - */ - if (!GTK_IS_ICON_VIEW (item->widget)) - return FALSE; - - if (item->item == NULL) - return FALSE; - - gtk_widget_get_allocation (item->widget, &allocation); - - icon_view = GTK_ICON_VIEW (item->widget); - visible_rect.x = 0; - if (icon_view->priv->hadjustment) - visible_rect.x += gtk_adjustment_get_value (icon_view->priv->hadjustment); - visible_rect.y = 0; - if (icon_view->priv->vadjustment) - visible_rect.y += gtk_adjustment_get_value (icon_view->priv->vadjustment); - visible_rect.width = allocation.width; - visible_rect.height = allocation.height; - - if (((item->item->cell_area.x + item->item->cell_area.width) < visible_rect.x) || - ((item->item->cell_area.y + item->item->cell_area.height) < (visible_rect.y)) || - (item->item->cell_area.x > (visible_rect.x + visible_rect.width)) || - (item->item->cell_area.y > (visible_rect.y + visible_rect.height))) - is_showing = FALSE; - else - is_showing = TRUE; - - return is_showing; -} - -static gboolean -gtk_icon_view_item_accessible_set_visibility (GtkIconViewItemAccessible *item, - gboolean emit_signal) -{ - if (gtk_icon_view_item_accessible_is_showing (item)) - return gtk_icon_view_item_accessible_add_state (item, ATK_STATE_SHOWING, - emit_signal); - else - return gtk_icon_view_item_accessible_remove_state (item, ATK_STATE_SHOWING, - emit_signal); -} - -static void -_gtk_icon_view_item_accessible_init (GtkIconViewItemAccessible *item) -{ - atk_object_set_role (ATK_OBJECT (item), ATK_ROLE_ICON); - - item->state_set = atk_state_set_new (); - atk_state_set_add_state (item->state_set, ATK_STATE_ENABLED); - atk_state_set_add_state (item->state_set, ATK_STATE_FOCUSABLE); - atk_state_set_add_state (item->state_set, ATK_STATE_SENSITIVE); - atk_state_set_add_state (item->state_set, ATK_STATE_SELECTABLE); - atk_state_set_add_state (item->state_set, ATK_STATE_VISIBLE); - - item->action_description = NULL; - item->image_description = NULL; - - item->action_idle_handler = 0; -} - -static void -_gtk_icon_view_item_accessible_finalize (GObject *object) -{ - GtkIconViewItemAccessible *item; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (object); - - if (item->widget) - g_object_remove_weak_pointer (G_OBJECT (item->widget), (gpointer) &item->widget); - - if (item->state_set) - g_object_unref (item->state_set); - - - g_free (item->text); - g_free (item->action_description); - g_free (item->image_description); - - if (item->action_idle_handler) - { - g_source_remove (item->action_idle_handler); - item->action_idle_handler = 0; - } - - G_OBJECT_CLASS (_gtk_icon_view_item_accessible_parent_class)->finalize (object); -} - -static AtkObject* -_gtk_icon_view_item_accessible_get_parent (AtkObject *obj) -{ - GtkIconViewItemAccessible *item; - - g_return_val_if_fail (GTK_IS_ICON_VIEW_ITEM_ACCESSIBLE (obj), NULL); - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (obj); - - if (item->widget) - return gtk_widget_get_accessible (item->widget); - else - return NULL; -} - -static int -_gtk_icon_view_item_accessible_get_index_in_parent (AtkObject *obj) -{ - GtkIconViewItemAccessible *item; - - g_return_val_if_fail (GTK_IS_ICON_VIEW_ITEM_ACCESSIBLE (obj), 0); - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (obj); - - return item->item->index; -} - -static AtkStateSet * -_gtk_icon_view_item_accessible_ref_state_set (AtkObject *obj) -{ - GtkIconViewItemAccessible *item; - GtkIconView *icon_view; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (obj); - g_return_val_if_fail (item->state_set, NULL); - - if (!item->widget) - return NULL; - - icon_view = GTK_ICON_VIEW (item->widget); - if (icon_view->priv->cursor_item == item->item) - atk_state_set_add_state (item->state_set, ATK_STATE_FOCUSED); - else - atk_state_set_remove_state (item->state_set, ATK_STATE_FOCUSED); - if (item->item->selected) - atk_state_set_add_state (item->state_set, ATK_STATE_SELECTED); - else - atk_state_set_remove_state (item->state_set, ATK_STATE_SELECTED); - - return g_object_ref (item->state_set); -} - -static void -_gtk_icon_view_item_accessible_class_init (GtkIconViewItemAccessibleClass *klass) -{ - GObjectClass *gobject_class; - AtkObjectClass *atk_class; - - gobject_class = (GObjectClass *)klass; - atk_class = (AtkObjectClass *)klass; - - gobject_class->finalize = _gtk_icon_view_item_accessible_finalize; - - atk_class->get_index_in_parent = _gtk_icon_view_item_accessible_get_index_in_parent; - atk_class->get_parent = _gtk_icon_view_item_accessible_get_parent; - atk_class->ref_state_set = _gtk_icon_view_item_accessible_ref_state_set; -} - -static void atk_component_interface_init (AtkComponentIface *iface); -static void atk_selection_interface_init (AtkSelectionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkIconViewAccessible, gtk_icon_view_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkIconViewAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) - -typedef struct -{ - AtkObject *item; - int index; -} ItemAccessibleInfo; - - -static void -gtk_icon_view_item_accessible_info_new (GtkIconViewAccessible *self, - GtkIconViewItemAccessible *item, - int index) -{ - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - ItemAccessibleInfo *info; - ItemAccessibleInfo *tmp_info; - GList *items; - - info = g_new (ItemAccessibleInfo, 1); - info->item = ATK_OBJECT (item); - info->index = index; - - items = priv->items; - while (items) - { - tmp_info = items->data; - if (tmp_info->index > index) - break; - items = items->next; - } - - priv->items = g_list_insert_before (priv->items, items, info); -} - -static int -gtk_icon_view_accessible_get_n_children (AtkObject *accessible) -{ - GtkIconView *icon_view; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (!widget) - return 0; - - icon_view = GTK_ICON_VIEW (widget); - - return g_list_length (icon_view->priv->items); -} - -static GtkIconViewItemAccessible * -gtk_icon_view_accessible_find_child (GtkIconViewAccessible *self, - int index) -{ - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - GList *items; - - items = priv->items; - - while (items) - { - ItemAccessibleInfo *info = items->data; - GList *next = items->next; - - if (info->index == index) - return GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item); - - items = next; - } - - return NULL; -} - -static AtkObject * -gtk_icon_view_accessible_ref_child (AtkObject *accessible, - int index) -{ - GtkIconViewAccessible *self = GTK_ICON_VIEW_ACCESSIBLE (accessible); - GtkIconViewItemAccessible *a11y_item; - GtkIconView *icon_view; - GtkWidget *widget; - GList *icons; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - icon_view = GTK_ICON_VIEW (widget); - icons = g_list_nth (icon_view->priv->items, index); - if (icons) - { - GtkIconViewItem *item = icons->data; - - g_return_val_if_fail (item->index == index, NULL); - - a11y_item = gtk_icon_view_accessible_find_child (self, index); - if (a11y_item == NULL) - { - a11y_item = g_object_new (GTK_TYPE_ICON_VIEW_ITEM_ACCESSIBLE, NULL); - a11y_item->item = item; - a11y_item->widget = widget; - - g_free (a11y_item->text); - a11y_item->text = get_text (icon_view, item); - - gtk_icon_view_item_accessible_set_visibility (a11y_item, FALSE); - g_object_add_weak_pointer (G_OBJECT (widget), (gpointer) &(a11y_item->widget)); - - gtk_icon_view_item_accessible_info_new (self, a11y_item, index); - } - - g_object_ref (a11y_item); - - return ATK_OBJECT (a11y_item); - } - else - { - return NULL; - } -} - -static void -gtk_icon_view_accessible_traverse_items (GtkIconViewAccessible *self, - GList *list) -{ - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - GtkWidget *widget; - gboolean act_on_item; - GList *items; - - if (priv->items == NULL) - return; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); - if (widget == NULL) - return; - - items = priv->items; - - act_on_item = (list == NULL); - - while (items) - { - ItemAccessibleInfo *info = items->data; - GtkIconViewItemAccessible *item; - GList *next = items->next; - - item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item); - - if (act_on_item == FALSE && list == items) - act_on_item = TRUE; - - if (act_on_item) - gtk_icon_view_item_accessible_set_visibility (item, TRUE); - - items = next; - } -} - -void -gtk_icon_view_accessible_adjustment_changed (GtkIconViewAccessible *self) -{ - gtk_icon_view_accessible_traverse_items (self, NULL); -} - -static void -gtk_icon_view_accessible_model_row_changed (GtkTreeModel *tree_model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) -{ - GtkIconViewAccessible *self = user_data; - GtkIconViewItemAccessible *a11y_item; - int index; - - index = gtk_tree_path_get_indices (path)[0]; - a11y_item = gtk_icon_view_accessible_find_child (self, index); - if (a11y_item) - { - GtkIconViewItem *item = a11y_item->item; - GtkIconView *icon_view = GTK_ICON_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (self))); - - const char *name = atk_object_get_name (ATK_OBJECT (a11y_item)); - if (name == NULL || *name == '\0') - { - g_free (a11y_item->text); - a11y_item->text = get_text (icon_view, item); - } - } - - g_signal_emit_by_name (self, "visible-data-changed"); -} - -static void -gtk_icon_view_accessible_model_row_inserted (GtkTreeModel *tree_model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) -{ - GtkIconViewAccessible *self = user_data; - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - GList *items; - GList *tmp_list; - int index; - - index = gtk_tree_path_get_indices (path)[0]; - - items = priv->items; - tmp_list = NULL; - while (items) - { - ItemAccessibleInfo *info = items->data; - GtkIconViewItemAccessible *item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item); - GList *next = items->next; - - if (info->index != item->item->index) - { - if (info->index < index) - g_warning ("Unexpected index value on insertion %d %d", index, info->index); - - if (tmp_list == NULL) - tmp_list = items; - - info->index = item->item->index; - } - - items = next; - } - - gtk_icon_view_accessible_traverse_items (self, tmp_list); - g_signal_emit_by_name (self, - "children-changed::add", - index, NULL, NULL); -} - -static void -gtk_icon_view_accessible_model_row_deleted (GtkTreeModel *tree_model, - GtkTreePath *path, - gpointer user_data) -{ - GtkIconViewAccessible *self = user_data; - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - GList *items; - GList *tmp_list = NULL; - GList *deleted_item = NULL; - int index; - - index = gtk_tree_path_get_indices (path)[0]; - - items = priv->items; - while (items) - { - ItemAccessibleInfo *info = items->data; - GtkIconViewItemAccessible *item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item); - GList *next = items->next; - - if (info->index == index) - { - deleted_item = items; - } - else if (info->index != item->item->index) - { - if (tmp_list == NULL) - tmp_list = items; - - info->index = item->item->index; - } - - items = next; - } - - if (deleted_item) - { - ItemAccessibleInfo *info = deleted_item->data; - - gtk_icon_view_item_accessible_add_state (GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item), - ATK_STATE_DEFUNCT, - TRUE); - - g_signal_emit_by_name (self, - "children-changed::remove", - index, NULL, NULL); - - priv->items = g_list_delete_link (priv->items, deleted_item); - g_object_unref (info->item); - g_free (info); - } - - gtk_icon_view_accessible_traverse_items (self, tmp_list); -} - -static int -gtk_icon_view_accessible_item_compare (ItemAccessibleInfo *i1, - ItemAccessibleInfo *i2) -{ - return i1->index - i2->index; -} - -static void -gtk_icon_view_accessible_model_rows_reordered (GtkTreeModel *tree_model, - GtkTreePath *path, - GtkTreeIter *iter, - int *new_order, - gpointer user_data) -{ - GtkIconViewAccessible *self = user_data; - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - GtkIconView *icon_view; - GList *items; - int *order; - int length, i; - - icon_view = GTK_ICON_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (self))); - length = gtk_tree_model_iter_n_children (tree_model, NULL); - - order = g_new (int, length); - for (i = 0; i < length; i++) - order [new_order[i]] = i; - - items = priv->items; - while (items) - { - ItemAccessibleInfo *info = items->data; - GtkIconViewItemAccessible *item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item); - GList *next = items->next; - - info->index = order[info->index]; - item->item = g_list_nth_data (icon_view->priv->items, info->index); - - items = next; - } - - g_free (order); - - priv->items = g_list_sort (priv->items, (GCompareFunc) gtk_icon_view_accessible_item_compare); -} - -static void -gtk_icon_view_accessible_disconnect_model_signals (GtkIconViewAccessible *self) -{ - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - - g_signal_handlers_disconnect_by_func (priv->model, gtk_icon_view_accessible_model_row_changed, self); - g_signal_handlers_disconnect_by_func (priv->model, gtk_icon_view_accessible_model_row_inserted, self); - g_signal_handlers_disconnect_by_func (priv->model, gtk_icon_view_accessible_model_row_deleted, self); - g_signal_handlers_disconnect_by_func (priv->model, gtk_icon_view_accessible_model_rows_reordered, self); -} - -static void -gtk_icon_view_accessible_connect_model_signals (GtkIconViewAccessible *self) -{ - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - - g_signal_connect_object (priv->model, "row-changed", - G_CALLBACK (gtk_icon_view_accessible_model_row_changed), - self, 0); - g_signal_connect_object (priv->model, "row-inserted", - G_CALLBACK (gtk_icon_view_accessible_model_row_inserted), - self, G_CONNECT_AFTER); - g_signal_connect_object (priv->model, "row-deleted", - G_CALLBACK (gtk_icon_view_accessible_model_row_deleted), - self, G_CONNECT_AFTER); - g_signal_connect_object (priv->model, "rows-reordered", - G_CALLBACK (gtk_icon_view_accessible_model_rows_reordered), - self, G_CONNECT_AFTER); -} - -static void -gtk_icon_view_accessible_clear_cache (GtkIconViewAccessible *self) -{ - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - GList *items; - - if (priv->items == NULL) - return; - - items = priv->items; - while (items != NULL) - { - ItemAccessibleInfo *info = items->data; - GList *next = items->next; - - gtk_icon_view_item_accessible_add_state (GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item), - ATK_STATE_DEFUNCT, - TRUE); - g_object_unref (info->item); - g_free (info); - - items = next; - } - - g_clear_pointer (&priv->items, g_list_free); -} - -void -gtk_icon_view_accessible_update_model (GtkIconViewAccessible *self, - GtkTreeModel *model) -{ - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - - if (priv->model != NULL) - { - g_object_remove_weak_pointer (G_OBJECT (priv->model), - (gpointer *) &priv->model); - gtk_icon_view_accessible_disconnect_model_signals (self); - } - - gtk_icon_view_accessible_clear_cache (self); - - priv->model = model; - - /* If there is no model the GtkIconView is probably being destroyed */ - if (priv->model != NULL) - { - g_object_add_weak_pointer (G_OBJECT (priv->model), (gpointer *) &priv->model); - gtk_icon_view_accessible_connect_model_signals (self); - } -} - -static void -gtk_icon_view_accessible_initialize (AtkObject *accessible, - gpointer data) -{ - GtkIconViewAccessible *self = GTK_ICON_VIEW_ACCESSIBLE (accessible); - GtkIconViewAccessiblePrivate *priv = gtk_icon_view_accessible_get_instance_private (self); - GtkIconView *icon_view = data; - - if (ATK_OBJECT_CLASS (gtk_icon_view_accessible_parent_class)->initialize) - ATK_OBJECT_CLASS (gtk_icon_view_accessible_parent_class)->initialize (accessible, data); - - priv->model = icon_view->priv->model; - if (priv->model) - { - g_object_add_weak_pointer (G_OBJECT (priv->model), (gpointer *) &priv->model); - gtk_icon_view_accessible_connect_model_signals (self); - } - - accessible->role = ATK_ROLE_LAYERED_PANE; -} - -static void -gtk_icon_view_accessible_finalize (GObject *object) -{ - GtkIconViewAccessible *view = GTK_ICON_VIEW_ACCESSIBLE (object); - - gtk_icon_view_accessible_clear_cache (view); - - G_OBJECT_CLASS (gtk_icon_view_accessible_parent_class)->finalize (object); -} - -static void -gtk_icon_view_accessible_class_init (GtkIconViewAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); - - gobject_class->finalize = gtk_icon_view_accessible_finalize; - - atk_class->get_n_children = gtk_icon_view_accessible_get_n_children; - atk_class->ref_child = gtk_icon_view_accessible_ref_child; - atk_class->initialize = gtk_icon_view_accessible_initialize; -} - -static void -gtk_icon_view_accessible_init (GtkIconViewAccessible *accessible) -{ -} - -static AtkObject* -gtk_icon_view_accessible_ref_accessible_at_point (AtkComponent *component, - int x, - int y, - AtkCoordType coord_type) -{ - GtkWidget *widget; - GtkIconView *icon_view; - GtkIconViewItem *item; - int x_pos, y_pos; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (widget == NULL) - return NULL; - - icon_view = GTK_ICON_VIEW (widget); - atk_component_get_extents (component, &x_pos, &y_pos, NULL, NULL, coord_type); - item = _gtk_icon_view_get_item_at_coords (icon_view, x - x_pos, y - y_pos, TRUE, NULL); - if (item) - return gtk_icon_view_accessible_ref_child (ATK_OBJECT (component), item->index); - - return NULL; -} - -static void -atk_component_interface_init (AtkComponentIface *iface) -{ - iface->ref_accessible_at_point = gtk_icon_view_accessible_ref_accessible_at_point; -} - -static gboolean -gtk_icon_view_accessible_add_selection (AtkSelection *selection, - int i) -{ - GtkWidget *widget; - GtkIconView *icon_view; - GtkIconViewItem *item; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - icon_view = GTK_ICON_VIEW (widget); - - item = g_list_nth_data (icon_view->priv->items, i); - if (!item) - return FALSE; - - _gtk_icon_view_select_item (icon_view, item); - - return TRUE; -} - -static gboolean -gtk_icon_view_accessible_clear_selection (AtkSelection *selection) -{ - GtkWidget *widget; - GtkIconView *icon_view; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - icon_view = GTK_ICON_VIEW (widget); - gtk_icon_view_unselect_all (icon_view); - - return TRUE; -} - -static AtkObject* -gtk_icon_view_accessible_ref_selection (AtkSelection *selection, - int i) -{ - GList *l; - GtkWidget *widget; - GtkIconView *icon_view; - GtkIconViewItem *item; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return NULL; - - icon_view = GTK_ICON_VIEW (widget); - - l = icon_view->priv->items; - while (l) - { - item = l->data; - if (item->selected) - { - if (i == 0) - return atk_object_ref_accessible_child (gtk_widget_get_accessible (widget), item->index); - else - i--; - } - l = l->next; - } - - return NULL; -} - -static int -gtk_icon_view_accessible_get_selection_count (AtkSelection *selection) -{ - GtkWidget *widget; - GtkIconView *icon_view; - GtkIconViewItem *item; - GList *l; - int count; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return 0; - - icon_view = GTK_ICON_VIEW (widget); - - l = icon_view->priv->items; - count = 0; - while (l) - { - item = l->data; - - if (item->selected) - count++; - - l = l->next; - } - - return count; -} - -static gboolean -gtk_icon_view_accessible_is_child_selected (AtkSelection *selection, - int i) -{ - GtkWidget *widget; - GtkIconView *icon_view; - GtkIconViewItem *item; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - icon_view = GTK_ICON_VIEW (widget); - - item = g_list_nth_data (icon_view->priv->items, i); - if (!item) - return FALSE; - - return item->selected; -} - -static gboolean -gtk_icon_view_accessible_remove_selection (AtkSelection *selection, - int i) -{ - GtkWidget *widget; - GtkIconView *icon_view; - GtkIconViewItem *item; - GList *l; - int count; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - icon_view = GTK_ICON_VIEW (widget); - l = icon_view->priv->items; - count = 0; - while (l) - { - item = l->data; - if (item->selected) - { - if (count == i) - { - _gtk_icon_view_unselect_item (icon_view, item); - return TRUE; - } - count++; - } - l = l->next; - } - - return FALSE; -} - -static gboolean -gtk_icon_view_accessible_select_all_selection (AtkSelection *selection) -{ - GtkWidget *widget; - GtkIconView *icon_view; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - icon_view = GTK_ICON_VIEW (widget); - gtk_icon_view_select_all (icon_view); - return TRUE; -} - -static void -atk_selection_interface_init (AtkSelectionIface *iface) -{ - iface->add_selection = gtk_icon_view_accessible_add_selection; - iface->clear_selection = gtk_icon_view_accessible_clear_selection; - iface->ref_selection = gtk_icon_view_accessible_ref_selection; - iface->get_selection_count = gtk_icon_view_accessible_get_selection_count; - iface->is_child_selected = gtk_icon_view_accessible_is_child_selected; - iface->remove_selection = gtk_icon_view_accessible_remove_selection; - iface->select_all_selection = gtk_icon_view_accessible_select_all_selection; -} diff --git a/gtk/a11y/gtkiconviewaccessible.h b/gtk/a11y/gtkiconviewaccessible.h deleted file mode 100644 index a6c51151a6..0000000000 --- a/gtk/a11y/gtkiconviewaccessible.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_ICON_VIEW_ACCESSIBLE_H__ -#define __GTK_ICON_VIEW_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_ICON_VIEW_ACCESSIBLE (gtk_icon_view_accessible_get_type ()) -#define GTK_ICON_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW_ACCESSIBLE, GtkIconViewAccessible)) -#define GTK_ICON_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_VIEW_ACCESSIBLE, GtkIconViewAccessibleClass)) -#define GTK_IS_ICON_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW_ACCESSIBLE)) -#define GTK_IS_ICON_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_VIEW_ACCESSIBLE)) -#define GTK_ICON_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_VIEW_ACCESSIBLE, GtkIconViewAccessibleClass)) - -typedef struct _GtkIconViewAccessible GtkIconViewAccessible; -typedef struct _GtkIconViewAccessibleClass GtkIconViewAccessibleClass; - -struct _GtkIconViewAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkIconViewAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_icon_view_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_ICON_VIEW_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkiconviewaccessibleprivate.h b/gtk/a11y/gtkiconviewaccessibleprivate.h deleted file mode 100644 index f5f36694ed..0000000000 --- a/gtk/a11y/gtkiconviewaccessibleprivate.h +++ /dev/null @@ -1,33 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_ICON_VIEW_ACCESSIBLE_PRIVATE_H__ -#define __GTK_ICON_VIEW_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtkiconviewaccessible.h> -#include <gtk/gtkiconview.h> - -G_BEGIN_DECLS - -void gtk_icon_view_accessible_adjustment_changed (GtkIconViewAccessible *self); - -void gtk_icon_view_accessible_update_model (GtkIconViewAccessible *self, - GtkTreeModel *model); - -G_END_DECLS - -#endif /* __GTK_ICON_VIEW_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtkimageaccessible.c b/gtk/a11y/gtkimageaccessible.c deleted file mode 100644 index a86a1074ef..0000000000 --- a/gtk/a11y/gtkimageaccessible.c +++ /dev/null @@ -1,338 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtkimageaccessible.h" -#include "gtkimageprivate.h" -#include "gtkintl.h" - -struct _GtkImageAccessiblePrivate -{ - char *image_description; - char *stock_name; -}; - -static void atk_image_interface_init (AtkImageIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkImageAccessible, gtk_image_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkImageAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init)) - -static void -gtk_image_accessible_initialize (AtkObject *accessible, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_image_accessible_parent_class)->initialize (accessible, data); - - accessible->role = ATK_ROLE_ICON; -} - -typedef struct { - const char *name; - const char *label; -} NameMapEntry; - -static const NameMapEntry name_map[] = { - { "help-about", NC_("Stock label", "_About") }, - { "list-add", NC_("Stock label", "_Add") }, - { "format-text-bold", NC_("Stock label", "_Bold") }, - { "media-optical", NC_("Stock label", "_CD-ROM") }, - { "edit-clear", NC_("Stock label", "_Clear") }, - { "window-close", NC_("Stock label", "_Close") }, - { "window-minimize", N_("Minimize") }, - { "window-maximize", N_("Maximize") }, - { "window-restore", N_("Restore") }, - { "edit-copy", NC_("Stock label", "_Copy") }, - { "edit-cut", NC_("Stock label", "Cu_t") }, - { "edit-delete", NC_("Stock label", "_Delete") }, - { "dialog-error", NC_("Stock label", "Error") }, - { "dialog-information", NC_("Stock label", "Information") }, - { "dialog-question", NC_("Stock label", "Question") }, - { "dialog-warning", NC_("Stock label", "Warning") }, - { "system-run", NC_("Stock label", "_Execute") }, - { "text-x-generic", NC_("Stock label", "_File") }, - { "edit-find", NC_("Stock label", "_Find") }, - { "edit-find-replace", NC_("Stock label", "Find and _Replace") }, - { "media-floppy", NC_("Stock label", "_Floppy") }, - { "view-fullscreen", NC_("Stock label", "_Fullscreen") }, - { "go-bottom", NC_("Stock label, navigation", "_Bottom") }, - { "go-first", NC_("Stock label, navigation", "_First") }, - { "go-last", NC_("Stock label, navigation", "_Last") }, - { "go-top", NC_("Stock label, navigation", "_Top") }, - { "go-previous", NC_("Stock label, navigation", "_Back") }, - { "go-down", NC_("Stock label, navigation", "_Down") }, - { "go-next", NC_("Stock label, navigation", "_Forward") }, - { "go-up", NC_("Stock label, navigation", "_Up") }, - { "drive-harddisk", NC_("Stock label", "_Hard Disk") }, - { "help-contents", NC_("Stock label", "_Help") }, - { "go-home", NC_("Stock label", "_Home") }, - { "format-indent-more", NC_("Stock label", "Increase Indent") }, - { "format-text-italic", NC_("Stock label", "_Italic") }, - { "go-jump", NC_("Stock label", "_Jump to") }, - { "format-justify-center", NC_("Stock label", "_Center") }, - { "format-justify-fill", NC_("Stock label", "_Fill") }, - { "format-justify-left", NC_("Stock label", "_Left") }, - { "format-justify-right", NC_("Stock label", "_Right") }, - { "view-restore", NC_("Stock label", "_Leave Fullscreen") }, - { "media-seek-forward", NC_("Stock label, media", "_Forward") }, - { "media-skip-forward", NC_("Stock label, media", "_Next") }, - { "media-playback-pause", NC_("Stock label, media", "P_ause") }, - { "media-playback-start", NC_("Stock label, media", "_Play") }, - { "media-skip-backward", NC_("Stock label, media", "Pre_vious") }, - { "media-record", NC_("Stock label, media", "_Record") }, - { "media-seek-backward", NC_("Stock label, media", "R_ewind") }, - { "media-playback-stop", NC_("Stock label, media", "_Stop") }, - { "network-idle", NC_("Stock label", "_Network") }, - { "document-new", NC_("Stock label", "_New") }, - { "document-open", NC_("Stock label", "_Open") }, - { "edit-paste", NC_("Stock label", "_Paste") }, - { "document-print", NC_("Stock label", "_Print") }, - { "document-print-preview", NC_("Stock label", "Print Pre_view") }, - { "document-properties", NC_("Stock label", "_Properties") }, - { "application-exit", NC_("Stock label", "_Quit") }, - { "edit-redo", NC_("Stock label", "_Redo") }, - { "view-refresh", NC_("Stock label", "_Refresh") }, - { "list-remove", NC_("Stock label", "_Remove") }, - { "document-revert", NC_("Stock label", "_Revert") }, - { "document-save", NC_("Stock label", "_Save") }, - { "document-save-as", NC_("Stock label", "Save _As") }, - { "edit-select-all", NC_("Stock label", "Select _All") }, - { "view-sort-ascending", NC_("Stock label", "_Ascending") }, - { "view-sort-descending", NC_("Stock label", "_Descending") }, - { "tools-check-spelling", NC_("Stock label", "_Spell Check") }, - { "process-stop", NC_("Stock label", "_Stop") }, - { "format-text-strikethrough", NC_("Stock label", "_Strikethrough") }, - { "format-text-underline", NC_("Stock label", "_Underline") }, - { "edit-undo", NC_("Stock label", "_Undo") }, - { "format-indent-less", NC_("Stock label", "Decrease Indent") }, - { "zoom-original", NC_("Stock label", "_Normal Size") }, - { "zoom-fit-best", NC_("Stock label", "Best _Fit") }, - { "zoom-in", NC_("Stock label", "Zoom _In") }, - { "zoom-out", NC_("Stock label", "Zoom _Out") } -}; - -/* GTK+ internal methods */ -static char * -elide_underscores (const char *original) -{ - char *q, *result; - const char *p, *end; - gsize len; - gboolean last_underscore; - - if (!original) - return NULL; - - len = strlen (original); - q = result = g_malloc (len + 1); - last_underscore = FALSE; - - end = original + len; - for (p = original; p < end; p++) - { - if (!last_underscore && *p == '_') - last_underscore = TRUE; - else - { - last_underscore = FALSE; - if (original + 2 <= p && p + 1 <= end && - p[-2] == '(' && p[-1] == '_' && p[0] != '_' && p[1] == ')') - { - q--; - *q = '\0'; - p++; - } - else - *q++ = *p; - } - } - - if (last_underscore) - *q++ = '_'; - - *q = '\0'; - - return result; -} - -static char * -name_from_icon_name (const char *icon_name) -{ - char *name; - const char *label; - int i; - - name = g_strdup (icon_name); - if (g_str_has_suffix (name, "-symbolic")) - name[strlen (name) - strlen ("-symbolic")] = '\0'; - - for (i = 0; i < G_N_ELEMENTS (name_map); i++) - { - if (g_str_equal (name, name_map[i].name)) - { - label = g_dpgettext2 (GETTEXT_PACKAGE, "Stock label", name_map[i].label); - g_free (name); - - return elide_underscores (label); - } - } - - g_free (name); - return NULL; -} - -static void -gtk_image_accessible_finalize (GObject *object) -{ - GtkImageAccessible *aimage = GTK_IMAGE_ACCESSIBLE (object); - - g_free (aimage->priv->image_description); - g_free (aimage->priv->stock_name); - - G_OBJECT_CLASS (gtk_image_accessible_parent_class)->finalize (object); -} - -static const char * -gtk_image_accessible_get_name (AtkObject *accessible) -{ - GtkWidget* widget; - GtkImage *image; - GtkImageAccessible *image_accessible; - const char *name; - GtkImageType storage_type; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - name = ATK_OBJECT_CLASS (gtk_image_accessible_parent_class)->get_name (accessible); - if (name) - return name; - - image = GTK_IMAGE (widget); - image_accessible = GTK_IMAGE_ACCESSIBLE (accessible); - - g_free (image_accessible->priv->stock_name); - image_accessible->priv->stock_name = NULL; - - storage_type = gtk_image_get_storage_type (image); - - if (storage_type == GTK_IMAGE_ICON_NAME) - { - image_accessible->priv->stock_name = name_from_icon_name (gtk_image_get_icon_name (image)); - } - else if (storage_type == GTK_IMAGE_GICON) - { - GIcon *icon; - const char * const *icon_names; - - icon = gtk_image_get_gicon (image); - if (G_IS_THEMED_ICON (icon)) - { - icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon)); - image_accessible->priv->stock_name = name_from_icon_name (icon_names[0]); - } - } - - return image_accessible->priv->stock_name; -} - -static void -gtk_image_accessible_class_init (GtkImageAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - gobject_class->finalize = gtk_image_accessible_finalize; - class->initialize = gtk_image_accessible_initialize; - class->get_name = gtk_image_accessible_get_name; -} - -static void -gtk_image_accessible_init (GtkImageAccessible *image) -{ - image->priv = gtk_image_accessible_get_instance_private (image); -} - -static const char * -gtk_image_accessible_get_image_description (AtkImage *image) -{ - GtkImageAccessible *accessible = GTK_IMAGE_ACCESSIBLE (image); - - return accessible->priv->image_description; -} - -static void -gtk_image_accessible_get_image_position (AtkImage *image, - int *x, - int *y, - AtkCoordType coord_type) -{ - atk_component_get_extents (ATK_COMPONENT (image), x, y, NULL, NULL, - coord_type); -} - -static void -gtk_image_accessible_get_image_size (AtkImage *image, - int *width, - int *height) -{ - GtkWidget* widget; - GtkImage *gtk_image; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); - if (widget == NULL) - { - *height = -1; - *width = -1; - return; - } - - gtk_image = GTK_IMAGE (widget); - - if (gtk_image_get_storage_type (gtk_image) != GTK_IMAGE_EMPTY) - gtk_image_get_image_size (gtk_image, width, height); - else - { - *height = 0; - *width = 0; - } -} - -static gboolean -gtk_image_accessible_set_image_description (AtkImage *image, - const char *description) -{ - GtkImageAccessible* accessible = GTK_IMAGE_ACCESSIBLE (image); - - g_free (accessible->priv->image_description); - accessible->priv->image_description = g_strdup (description); - - return TRUE; -} - -static void -atk_image_interface_init (AtkImageIface *iface) -{ - iface->get_image_description = gtk_image_accessible_get_image_description; - iface->get_image_position = gtk_image_accessible_get_image_position; - iface->get_image_size = gtk_image_accessible_get_image_size; - iface->set_image_description = gtk_image_accessible_set_image_description; -} diff --git a/gtk/a11y/gtkimageaccessible.h b/gtk/a11y/gtkimageaccessible.h deleted file mode 100644 index 47e0edc403..0000000000 --- a/gtk/a11y/gtkimageaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_IMAGE_ACCESSIBLE_H__ -#define __GTK_IMAGE_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_IMAGE_ACCESSIBLE (gtk_image_accessible_get_type ()) -#define GTK_IMAGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE_ACCESSIBLE, GtkImageAccessible)) -#define GTK_IMAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE_ACCESSIBLE, GtkImageAccessibleClass)) -#define GTK_IS_IMAGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE_ACCESSIBLE)) -#define GTK_IS_IMAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_ACCESSIBLE)) -#define GTK_IMAGE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE_ACCESSIBLE, GtkImageAccessibleClass)) - -typedef struct _GtkImageAccessible GtkImageAccessible; -typedef struct _GtkImageAccessibleClass GtkImageAccessibleClass; -typedef struct _GtkImageAccessiblePrivate GtkImageAccessiblePrivate; - -struct _GtkImageAccessible -{ - GtkWidgetAccessible parent; - - GtkImageAccessiblePrivate *priv; -}; - -struct _GtkImageAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_image_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_IMAGE_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkimagecellaccessible.c b/gtk/a11y/gtkimagecellaccessible.c deleted file mode 100644 index 4deb292cd6..0000000000 --- a/gtk/a11y/gtkimagecellaccessible.c +++ /dev/null @@ -1,123 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtkimagecellaccessible.h" - -struct _GtkImageCellAccessiblePrivate -{ - char *image_description; -}; - -static void atk_image_interface_init (AtkImageIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkImageCellAccessible, gtk_image_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE, - G_ADD_PRIVATE (GtkImageCellAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init)) - -static void -gtk_image_cell_accessible_finalize (GObject *object) -{ - GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (object); - - g_free (image_cell->priv->image_description); - G_OBJECT_CLASS (gtk_image_cell_accessible_parent_class)->finalize (object); -} - -static void -gtk_image_cell_accessible_class_init (GtkImageCellAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->finalize = gtk_image_cell_accessible_finalize; -} - -static void -gtk_image_cell_accessible_init (GtkImageCellAccessible *image_cell) -{ - image_cell->priv = gtk_image_cell_accessible_get_instance_private (image_cell); -} - -static const char * -gtk_image_cell_accessible_get_image_description (AtkImage *image) -{ - GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image); - - return image_cell->priv->image_description; -} - -static gboolean -gtk_image_cell_accessible_set_image_description (AtkImage *image, - const char *description) -{ - GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image); - - g_free (image_cell->priv->image_description); - image_cell->priv->image_description = g_strdup (description); - - if (image_cell->priv->image_description) - return TRUE; - else - return FALSE; -} - -static void -gtk_image_cell_accessible_get_image_position (AtkImage *image, - int *x, - int *y, - AtkCoordType coord_type) -{ - atk_component_get_extents (ATK_COMPONENT (image), x, y, NULL, NULL, - coord_type); -} - -static void -gtk_image_cell_accessible_get_image_size (AtkImage *image, - int *width, - int *height) -{ - GtkImageCellAccessible *cell = GTK_IMAGE_CELL_ACCESSIBLE (image); - GtkCellRenderer *cell_renderer; - GdkPixbuf *pixbuf = NULL; - - *width = 0; - *height = 0; - - g_object_get (cell, "renderer", &cell_renderer, NULL); - g_object_get (cell_renderer, - "pixbuf", &pixbuf, - NULL); - g_object_unref (cell_renderer); - - if (pixbuf) - { - *width = gdk_pixbuf_get_width (pixbuf); - *height = gdk_pixbuf_get_height (pixbuf); - g_object_unref (pixbuf); - } -} - -static void -atk_image_interface_init (AtkImageIface *iface) -{ - iface->get_image_description = gtk_image_cell_accessible_get_image_description; - iface->set_image_description = gtk_image_cell_accessible_set_image_description; - iface->get_image_position = gtk_image_cell_accessible_get_image_position; - iface->get_image_size = gtk_image_cell_accessible_get_image_size; -} diff --git a/gtk/a11y/gtkimagecellaccessible.h b/gtk/a11y/gtkimagecellaccessible.h deleted file mode 100644 index 5ab1c22e6e..0000000000 --- a/gtk/a11y/gtkimagecellaccessible.h +++ /dev/null @@ -1,58 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_IMAGE_CELL_ACCESSIBLE_H__ -#define __GTK_IMAGE_CELL_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <atk/atk.h> -#include <gtk/a11y/gtkrenderercellaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_IMAGE_CELL_ACCESSIBLE (gtk_image_cell_accessible_get_type ()) -#define GTK_IMAGE_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE_CELL_ACCESSIBLE, GtkImageCellAccessible)) -#define GTK_IMAGE_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_IMAGE_CELL_ACCESSIBLE, GtkImageCellAccessibleClass)) -#define GTK_IS_IMAGE_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE_CELL_ACCESSIBLE)) -#define GTK_IS_IMAGE_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_CELL_ACCESSIBLE)) -#define GTK_IMAGE_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE_CELL_ACCESSIBLE, GtkImageCellAccessibleClass)) - -typedef struct _GtkImageCellAccessible GtkImageCellAccessible; -typedef struct _GtkImageCellAccessibleClass GtkImageCellAccessibleClass; -typedef struct _GtkImageCellAccessiblePrivate GtkImageCellAccessiblePrivate; - -struct _GtkImageCellAccessible -{ - GtkRendererCellAccessible parent; - - GtkImageCellAccessiblePrivate *priv; -}; - -struct _GtkImageCellAccessibleClass -{ - GtkRendererCellAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_image_cell_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_IMAGE_CELL_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtklabelaccessible.c b/gtk/a11y/gtklabelaccessible.c deleted file mode 100644 index ce20a4fb5e..0000000000 --- a/gtk/a11y/gtklabelaccessible.c +++ /dev/null @@ -1,1192 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -/* Preamble {{{1 */ - -#include "config.h" - -#include <gtk/gtk.h> -#include <gtk/gtkpango.h> -#include "gtkwidgetprivate.h" -#include "gtklabelprivate.h" -#include "gtklabelaccessible.h" -#include "gtklabelaccessibleprivate.h" -#include "gtkstylecontextprivate.h" - -struct _GtkLabelAccessiblePrivate -{ - int cursor_position; - int selection_bound; - - GList *links; -}; - -typedef struct _GtkLabelAccessibleLink GtkLabelAccessibleLink; -typedef struct _GtkLabelAccessibleLinkClass GtkLabelAccessibleLinkClass; - -struct _GtkLabelAccessibleLink -{ - AtkHyperlink parent; - - GtkLabelAccessible *label; - int index; - gboolean focused; -}; - -struct _GtkLabelAccessibleLinkClass -{ - AtkHyperlinkClass parent_class; -}; - -static GtkLabelAccessibleLink *gtk_label_accessible_link_new (GtkLabelAccessible *label, - int idx); - -typedef struct _GtkLabelAccessibleLinkImpl GtkLabelAccessibleLinkImpl; -typedef struct _GtkLabelAccessibleLinkImplClass GtkLabelAccessibleLinkImplClass; - -struct _GtkLabelAccessibleLinkImpl -{ - AtkObject parent; - - GtkLabelAccessibleLink *link; -}; - -struct _GtkLabelAccessibleLinkImplClass -{ - AtkObjectClass parent_class; -}; - -/* GtkLabelAccessibleLinkImpl {{{1 */ - -GType _gtk_label_accessible_link_impl_get_type (void); - -static void atk_hyperlink_impl_interface_init (AtkHyperlinkImplIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkLabelAccessibleLinkImpl, _gtk_label_accessible_link_impl, ATK_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (ATK_TYPE_HYPERLINK_IMPL, atk_hyperlink_impl_interface_init)) - -static AtkHyperlink * -gtk_label_accessible_link_impl_get_hyperlink (AtkHyperlinkImpl *atk_impl) -{ - GtkLabelAccessibleLinkImpl *impl = (GtkLabelAccessibleLinkImpl *)atk_impl; - - return (AtkHyperlink *)g_object_ref (impl->link); -} - -static void -atk_hyperlink_impl_interface_init (AtkHyperlinkImplIface *iface) -{ - iface->get_hyperlink = gtk_label_accessible_link_impl_get_hyperlink; -} - -static AtkStateSet * -gtk_label_accessible_link_impl_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkLabelAccessibleLink *link; - GtkWidget *widget; - - link = ((GtkLabelAccessibleLinkImpl *)obj)->link; - - state_set = atk_object_ref_state_set (atk_object_get_parent (obj)); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_object_get_parent (obj))); - if (widget) - { - if (gtk_widget_get_can_focus (widget)) - { - atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); - if (_gtk_label_get_link_focused (GTK_LABEL (widget), link->index)) - atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); - else - atk_state_set_remove_state (state_set, ATK_STATE_FOCUSED); - } - - if (_gtk_label_get_link_visited (GTK_LABEL (widget), link->index)) - atk_state_set_add_state (state_set, ATK_STATE_VISITED); - } - - return state_set; -} - -static void -_gtk_label_accessible_link_impl_init (GtkLabelAccessibleLinkImpl *impl) -{ - atk_object_set_role (ATK_OBJECT (impl), ATK_ROLE_LINK); -} - -static void -_gtk_label_accessible_link_impl_finalize (GObject *obj) -{ - GtkLabelAccessibleLinkImpl *impl = (GtkLabelAccessibleLinkImpl *)obj; - - g_object_unref (impl->link); - - G_OBJECT_CLASS (_gtk_label_accessible_link_impl_parent_class)->finalize (obj); -} - -static void -_gtk_label_accessible_link_impl_class_init (GtkLabelAccessibleLinkImplClass *class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - AtkObjectClass *atk_obj_class = ATK_OBJECT_CLASS (class); - - object_class->finalize = _gtk_label_accessible_link_impl_finalize; - atk_obj_class->ref_state_set = gtk_label_accessible_link_impl_ref_state_set; -} - -/* 'Public' API {{{2 */ - -static GtkLabelAccessibleLinkImpl * -gtk_label_accessible_link_impl_new (GtkLabelAccessible *label, - int idx) -{ - GtkLabelAccessibleLinkImpl *impl; - - impl = g_object_new (_gtk_label_accessible_link_impl_get_type (), NULL); - impl->link = gtk_label_accessible_link_new (label, idx); - atk_object_set_parent (ATK_OBJECT (impl), ATK_OBJECT (label)); - - return impl; -} - -/* GtkLabelAccessibleLink {{{1 */ - -GType _gtk_label_accessible_link_get_type (void); - -static void atk_action_interface_init (AtkActionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkLabelAccessibleLink, _gtk_label_accessible_link, ATK_TYPE_HYPERLINK, - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - -static char * -gtk_label_accessible_link_get_uri (AtkHyperlink *atk_link, - int i) -{ - GtkLabelAccessibleLink *link = (GtkLabelAccessibleLink *)atk_link; - GtkWidget *widget; - const char *uri; - - g_return_val_if_fail (i == 0, NULL); - - if (link->label == NULL) - return NULL; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (link->label)); - uri = _gtk_label_get_link_uri (GTK_LABEL (widget), link->index); - - return g_strdup (uri); -} - -static int -gtk_label_accessible_link_get_n_anchors (AtkHyperlink *atk_link) -{ - return 1; -} - -static gboolean -gtk_label_accessible_link_is_valid (AtkHyperlink *atk_link) -{ - return TRUE; -} - -static AtkObject * -gtk_label_accessible_link_get_object (AtkHyperlink *atk_link, - int i) -{ - GtkLabelAccessibleLink *link = (GtkLabelAccessibleLink *)atk_link; - - g_return_val_if_fail (i == 0, NULL); - - return ATK_OBJECT (link->label); -} - -static int -gtk_label_accessible_link_get_start_index (AtkHyperlink *atk_link) -{ - GtkLabelAccessibleLink *link = (GtkLabelAccessibleLink *)atk_link; - GtkWidget *widget; - int start, end; - - if (link->label == NULL) - return 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (link->label)); - _gtk_label_get_link_extent (GTK_LABEL (widget), link->index, &start, &end); - - return start; -} - -static int -gtk_label_accessible_link_get_end_index (AtkHyperlink *atk_link) -{ - GtkLabelAccessibleLink *link = (GtkLabelAccessibleLink *)atk_link; - GtkWidget *widget; - int start, end; - - if (link->label == NULL) - return 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (link->label)); - _gtk_label_get_link_extent (GTK_LABEL (widget), link->index, &start, &end); - - return end; -} - -static void -_gtk_label_accessible_link_init (GtkLabelAccessibleLink *link) -{ -} - -static void -_gtk_label_accessible_link_class_init (GtkLabelAccessibleLinkClass *class) -{ - AtkHyperlinkClass *atk_link_class = ATK_HYPERLINK_CLASS (class); - - atk_link_class->get_uri = gtk_label_accessible_link_get_uri; - atk_link_class->get_n_anchors = gtk_label_accessible_link_get_n_anchors; - atk_link_class->is_valid = gtk_label_accessible_link_is_valid; - atk_link_class->get_object = gtk_label_accessible_link_get_object; - atk_link_class->get_start_index = gtk_label_accessible_link_get_start_index; - atk_link_class->get_end_index = gtk_label_accessible_link_get_end_index; -} - -/* 'Public' API {{{2 */ - -static GtkLabelAccessibleLink * -gtk_label_accessible_link_new (GtkLabelAccessible *label, - int idx) -{ - GtkLabelAccessibleLink *link; - - link = g_object_new (_gtk_label_accessible_link_get_type (), NULL); - link->label = label; - link->index = idx; - - return link; -} - -/* AtkAction implementation {{{2 */ - -static gboolean -gtk_label_accessible_link_do_action (AtkAction *action, - int i) -{ - GtkLabelAccessibleLink *link = (GtkLabelAccessibleLink *)action; - GtkWidget *widget; - - if (i != 0) - return FALSE; - - if (link->label == NULL) - return FALSE; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (link->label)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - _gtk_label_activate_link (GTK_LABEL (widget), link->index); - - return TRUE; -} - -static int -gtk_label_accessible_link_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_label_accessible_link_get_name (AtkAction *action, - int i) -{ - if (i != 0) - return NULL; - - return "activate"; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_label_accessible_link_do_action; - iface->get_n_actions = gtk_label_accessible_link_get_n_actions; - iface->get_name = gtk_label_accessible_link_get_name; -} - -/* GtkLabelAccessible {{{1 */ - -static void atk_text_interface_init (AtkTextIface *iface); -static void atk_hypertext_interface_init (AtkHypertextIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkLabelAccessible, gtk_label_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkLabelAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_HYPERTEXT, atk_hypertext_interface_init)) - -static void -gtk_label_accessible_init (GtkLabelAccessible *label) -{ - label->priv = gtk_label_accessible_get_instance_private (label); -} - -static void -gtk_label_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkWidget *widget; - - ATK_OBJECT_CLASS (gtk_label_accessible_parent_class)->initialize (obj, data); - - widget = GTK_WIDGET (data); - - _gtk_label_accessible_update_links (GTK_LABEL (widget)); - - /* Check whether ancestor of GtkLabel is a GtkButton - * and if so set accessible parent for GtkLabelAccessible - */ - while (widget != NULL) - { - widget = gtk_widget_get_parent (widget); - if (GTK_IS_BUTTON (widget)) - { - atk_object_set_parent (obj, gtk_widget_get_accessible (widget)); - break; - } - } - - obj->role = ATK_ROLE_LABEL; -} - -static gboolean -check_for_selection_change (GtkLabelAccessible *accessible, - GtkLabel *label) -{ - gboolean ret_val = FALSE; - int start, end; - - if (gtk_label_get_selection_bounds (label, &start, &end)) - { - if (end != accessible->priv->cursor_position || - start != accessible->priv->selection_bound) - ret_val = TRUE; - } - else - { - ret_val = (accessible->priv->cursor_position != accessible->priv->selection_bound); - } - - accessible->priv->cursor_position = end; - accessible->priv->selection_bound = start; - - return ret_val; -} - -/* atkobject.h */ - -static AtkStateSet * -gtk_label_accessible_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - state_set = ATK_OBJECT_CLASS (gtk_label_accessible_parent_class)->ref_state_set (accessible); - atk_state_set_add_state (state_set, ATK_STATE_MULTI_LINE); - - return state_set; -} - -static AtkRelationSet * -gtk_label_accessible_ref_relation_set (AtkObject *obj) -{ - GtkWidget *widget; - AtkRelationSet *relation_set; - - g_return_val_if_fail (GTK_IS_LABEL_ACCESSIBLE (obj), NULL); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - relation_set = ATK_OBJECT_CLASS (gtk_label_accessible_parent_class)->ref_relation_set (obj); - - if (!atk_relation_set_contains (relation_set, ATK_RELATION_LABEL_FOR)) - { - /* Get the mnemonic widget. - * The relation set is not updated if the mnemonic widget is changed - */ - GtkWidget *mnemonic_widget; - - mnemonic_widget = gtk_label_get_mnemonic_widget (GTK_LABEL (widget)); - - if (mnemonic_widget) - { - AtkObject *accessible_array[1]; - AtkRelation* relation; - - accessible_array[0] = gtk_widget_get_accessible (mnemonic_widget); - relation = atk_relation_new (accessible_array, 1, - ATK_RELATION_LABEL_FOR); - atk_relation_set_add (relation_set, relation); - /* - * Unref the relation so that it is not leaked. - */ - g_object_unref (relation); - } - } - return relation_set; -} - -static const char * -gtk_label_accessible_get_name (AtkObject *accessible) -{ - const char *name; - - g_return_val_if_fail (GTK_IS_LABEL_ACCESSIBLE (accessible), NULL); - - name = ATK_OBJECT_CLASS (gtk_label_accessible_parent_class)->get_name (accessible); - if (name != NULL) - return name; - else - { - /* - * Get the text on the label - */ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - g_return_val_if_fail (GTK_IS_LABEL (widget), NULL); - - return gtk_label_get_text (GTK_LABEL (widget)); - } -} - -static int -gtk_label_accessible_get_n_children (AtkObject *obj) -{ - GtkLabelAccessible *accessible = GTK_LABEL_ACCESSIBLE (obj); - - return g_list_length (accessible->priv->links); -} - -static AtkObject * -gtk_label_accessible_ref_child (AtkObject *obj, - int idx) -{ - GtkLabelAccessible *accessible = GTK_LABEL_ACCESSIBLE (obj); - AtkObject *child; - - child = g_list_nth_data (accessible->priv->links, idx); - - if (child) - g_object_ref (child); - - return child; -} - -static void clear_links (GtkLabelAccessible *accessible); - -static void -gtk_label_accessible_finalize (GObject *obj) -{ - GtkLabelAccessible *accessible = GTK_LABEL_ACCESSIBLE (obj); - - clear_links (accessible); - - G_OBJECT_CLASS (gtk_label_accessible_parent_class)->finalize (obj); -} - -static void -gtk_label_accessible_class_init (GtkLabelAccessibleClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - object_class->finalize = gtk_label_accessible_finalize; - - class->get_name = gtk_label_accessible_get_name; - class->ref_state_set = gtk_label_accessible_ref_state_set; - class->ref_relation_set = gtk_label_accessible_ref_relation_set; - class->initialize = gtk_label_accessible_initialize; - - class->get_n_children = gtk_label_accessible_get_n_children; - class->ref_child = gtk_label_accessible_ref_child; -} - -/* 'Public' API {{{2 */ - - -void -_gtk_label_accessible_selection_bound_changed (GtkLabel *label) -{ - AtkObject *obj; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (label)); - if (obj == NULL) - return; - - if (check_for_selection_change (GTK_LABEL_ACCESSIBLE (obj), label)) - g_signal_emit_by_name (obj, "text-selection-changed"); -} - -void -_gtk_label_accessible_cursor_position_changed (GtkLabel *label) -{ - AtkObject *obj; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (label)); - if (obj == NULL) - return; - - g_signal_emit_by_name (obj, "text-caret-moved", _gtk_label_get_cursor_position (label)); - - if (check_for_selection_change (GTK_LABEL_ACCESSIBLE (obj), label)) - g_signal_emit_by_name (obj, "text-selection-changed"); -} - -void -_gtk_label_accessible_text_deleted (GtkLabel *label) -{ - AtkObject *obj; - const char *text; - guint length; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (label)); - if (obj == NULL) - return; - - text = gtk_label_get_text (label); - length = g_utf8_strlen (text, -1); - if (length > 0) - g_signal_emit_by_name (obj, "text-changed::delete", 0, length); -} - -void -_gtk_label_accessible_text_inserted (GtkLabel *label) -{ - AtkObject *obj; - const char *text; - guint length; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (label)); - if (obj == NULL) - return; - - text = gtk_label_get_text (label); - length = g_utf8_strlen (text, -1); - if (length > 0) - g_signal_emit_by_name (obj, "text-changed::insert", 0, length); - - if (obj->name == NULL) - /* The label has changed so notify a change in accessible-name */ - g_object_notify (G_OBJECT (obj), "accessible-name"); - - g_signal_emit_by_name (obj, "visible-data-changed"); -} - -static void -clear_links (GtkLabelAccessible *accessible) -{ - GList *l; - int i; - GtkLabelAccessibleLinkImpl *impl; - - for (l = accessible->priv->links, i = 0; l; l = l->next, i++) - { - impl = l->data; - g_signal_emit_by_name (accessible, "children-changed::remove", i, impl, NULL); - atk_object_set_parent (ATK_OBJECT (impl), NULL); - impl->link->label = NULL; - } - g_list_free_full (accessible->priv->links, g_object_unref); - accessible->priv->links = NULL; -} - -static void -create_links (GtkLabelAccessible *accessible) -{ - GtkWidget *widget; - int n, i; - GtkLabelAccessibleLinkImpl *impl; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - - n = _gtk_label_get_n_links (GTK_LABEL (widget)); - for (i = 0; i < n; i++) - { - impl = gtk_label_accessible_link_impl_new (accessible, i); - accessible->priv->links = g_list_append (accessible->priv->links, impl); - g_signal_emit_by_name (accessible, "children-changed::add", i, impl, NULL); - } -} - -void -_gtk_label_accessible_update_links (GtkLabel *label) -{ - AtkObject *obj; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (label)); - if (obj == NULL) - return; - - clear_links (GTK_LABEL_ACCESSIBLE (obj)); - create_links (GTK_LABEL_ACCESSIBLE (obj)); -} - -void -_gtk_label_accessible_focus_link_changed (GtkLabel *label) -{ - AtkObject *obj; - GtkLabelAccessible *accessible; - GList *l; - GtkLabelAccessibleLinkImpl *impl; - gboolean focused; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (label)); - if (obj == NULL) - return; - - accessible = GTK_LABEL_ACCESSIBLE (obj); - - for (l = accessible->priv->links; l; l = l->next) - { - impl = l->data; - focused = _gtk_label_get_link_focused (label, impl->link->index); - if (impl->link->focused != focused) - { - impl->link->focused = focused; - atk_object_notify_state_change (ATK_OBJECT (impl), ATK_STATE_FOCUSED, focused); - } - } -} - -/* AtkText implementation {{{2 */ - -static char * -gtk_label_accessible_get_text (AtkText *atk_text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - const char *text; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return NULL; - - text = gtk_label_get_text (GTK_LABEL (widget)); - - if (text) - { - guint length; - const char *start, *end; - - length = g_utf8_strlen (text, -1); - if (end_pos < 0 || end_pos > length) - end_pos = length; - if (start_pos > length) - start_pos = length; - if (end_pos <= start_pos) - return g_strdup (""); - start = g_utf8_offset_to_pointer (text, start_pos); - end = g_utf8_offset_to_pointer (start, end_pos - start_pos); - return g_strndup (start, end - start); - } - - return NULL; -} - -static char * -gtk_label_accessible_get_text_before_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - return _gtk_pango_get_text_before (gtk_label_get_layout (GTK_LABEL (widget)), - boundary_type, offset, - start_offset, end_offset); -} - -static char * -gtk_label_accessible_get_text_at_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - return _gtk_pango_get_text_at (gtk_label_get_layout (GTK_LABEL (widget)), - boundary_type, offset, - start_offset, end_offset); -} - -static char * -gtk_label_accessible_get_text_after_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - return _gtk_pango_get_text_after (gtk_label_get_layout (GTK_LABEL (widget)), - boundary_type, offset, - start_offset, end_offset); -} - -static int -gtk_label_accessible_get_character_count (AtkText *atk_text) -{ - GtkWidget *widget; - const char *text; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return 0; - - text = gtk_label_get_text (GTK_LABEL (widget)); - - if (text) - return g_utf8_strlen (text, -1); - - return 0; -} - -static int -gtk_label_accessible_get_caret_offset (AtkText *text) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return -1; - - /* Non-selectable labels cannot have a caret. */ - if (!gtk_label_get_selectable (GTK_LABEL (widget))) - return -1; - - return _gtk_label_get_cursor_position (GTK_LABEL (widget)); -} - -static gboolean -gtk_label_accessible_set_caret_offset (AtkText *text, - int offset) -{ - GtkWidget *widget; - GtkLabel *label; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - label = GTK_LABEL (widget); - - if (!gtk_label_get_selectable (label)) - return FALSE; - - gtk_label_select_region (label, offset, offset); - - return TRUE; -} - -static int -gtk_label_accessible_get_n_selections (AtkText *text) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return 0; - - if (gtk_label_get_selection_bounds (GTK_LABEL (widget), NULL, NULL)) - return 1; - - return 0; -} - -static char * -gtk_label_accessible_get_selection (AtkText *atk_text, - int selection_num, - int *start_pos, - int *end_pos) -{ - GtkWidget *widget; - GtkLabel *label; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return NULL; - - if (selection_num != 0) - return NULL; - - label = GTK_LABEL (widget); - - if (gtk_label_get_selection_bounds (label, start_pos, end_pos)) - { - const char *text; - - text = gtk_label_get_text (label); - - if (text) - return g_utf8_substring (text, *start_pos, *end_pos); - } - - return NULL; -} - -static gboolean -gtk_label_accessible_add_selection (AtkText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkLabel *label; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - label = GTK_LABEL (widget); - - if (!gtk_label_get_selectable (label)) - return FALSE; - - if (!gtk_label_get_selection_bounds (label, &start, &end)) - { - gtk_label_select_region (label, start_pos, end_pos); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_label_accessible_remove_selection (AtkText *text, - int selection_num) -{ - GtkWidget *widget; - GtkLabel *label; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - label = GTK_LABEL (widget); - - if (!gtk_label_get_selectable (label)) - return FALSE; - - if (gtk_label_get_selection_bounds (label, &start, &end)) - { - gtk_label_select_region (label, end, end); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_label_accessible_set_selection (AtkText *text, - int selection_num, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkLabel *label; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - label = GTK_LABEL (widget); - - if (!gtk_label_get_selectable (label)) - return FALSE; - - if (gtk_label_get_selection_bounds (label, &start, &end)) - { - gtk_label_select_region (label, start_pos, end_pos); - return TRUE; - } - else - return FALSE; -} - -static void -gtk_label_accessible_get_character_extents (AtkText *text, - int offset, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coords) -{ - GtkWidget *widget; - GtkLabel *label; - PangoRectangle char_rect; - const char *label_text; - int index, x_layout, y_layout; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - label = GTK_LABEL (widget); - - gtk_label_get_layout_offsets (label, &x_layout, &y_layout); - label_text = gtk_label_get_text (label); - index = g_utf8_offset_to_pointer (label_text, offset) - label_text; - pango_layout_index_to_pos (gtk_label_get_layout (label), index, &char_rect); - pango_extents_to_pixels (&char_rect, NULL); - - *x = x_layout + char_rect.x; - *y = y_layout + char_rect.y; - *width = char_rect.width; - *height = char_rect.height; -} - -static int -gtk_label_accessible_get_offset_at_point (AtkText *atk_text, - int x, - int y, - AtkCoordType coords) -{ - GtkWidget *widget; - GtkLabel *label; - const char *text; - int index, x_layout, y_layout; - int x_local, y_local; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return -1; - - label = GTK_LABEL (widget); - - gtk_label_get_layout_offsets (label, &x_layout, &y_layout); - - x_local = x - x_layout; - y_local = y - y_layout; - - if (!pango_layout_xy_to_index (gtk_label_get_layout (label), - x_local * PANGO_SCALE, - y_local * PANGO_SCALE, - &index, NULL)) - { - if (x_local < 0 || y_local < 0) - index = 0; - else - index = -1; - } - - if (index != -1) - { - text = gtk_label_get_text (label); - return g_utf8_pointer_to_offset (text, text + index); - } - - return -1; -} - -static AtkAttributeSet * -add_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - const char *value) -{ - AtkAttribute *at; - - at = g_new (AtkAttribute, 1); - at->name = g_strdup (atk_text_attribute_get_name (attr)); - at->value = g_strdup (value); - - return g_slist_prepend (attributes, at); -} - -static AtkAttributeSet* -gtk_label_accessible_get_run_attributes (AtkText *text, - int offset, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - AtkAttributeSet *attributes; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - attributes = NULL; - attributes = add_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, - atk_text_attribute_get_value (ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (widget))); - attributes = _gtk_pango_get_run_attributes (attributes, - gtk_label_get_layout (GTK_LABEL (widget)), - offset, - start_offset, - end_offset); - - return attributes; -} - -static AtkAttributeSet * -gtk_label_accessible_get_default_attributes (AtkText *text) -{ - GtkWidget *widget; - AtkAttributeSet *attributes; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - attributes = NULL; - attributes = add_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, - atk_text_attribute_get_value (ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (widget))); - attributes = _gtk_pango_get_default_attributes (attributes, - gtk_label_get_layout (GTK_LABEL (widget))); - attributes = _gtk_style_context_get_attributes (attributes, - gtk_widget_get_style_context (widget)); - - return attributes; -} - -static gunichar -gtk_label_accessible_get_character_at_offset (AtkText *atk_text, - int offset) -{ - GtkWidget *widget; - const char *text; - char *index; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return '\0'; - - text = gtk_label_get_text (GTK_LABEL (widget)); - if (offset >= g_utf8_strlen (text, -1)) - return '\0'; - - index = g_utf8_offset_to_pointer (text, offset); - - return g_utf8_get_char (index); -} - -static void -atk_text_interface_init (AtkTextIface *iface) -{ - iface->get_text = gtk_label_accessible_get_text; - iface->get_character_at_offset = gtk_label_accessible_get_character_at_offset; - iface->get_text_before_offset = gtk_label_accessible_get_text_before_offset; - iface->get_text_at_offset = gtk_label_accessible_get_text_at_offset; - iface->get_text_after_offset = gtk_label_accessible_get_text_after_offset; - iface->get_character_count = gtk_label_accessible_get_character_count; - iface->get_caret_offset = gtk_label_accessible_get_caret_offset; - iface->set_caret_offset = gtk_label_accessible_set_caret_offset; - iface->get_n_selections = gtk_label_accessible_get_n_selections; - iface->get_selection = gtk_label_accessible_get_selection; - iface->add_selection = gtk_label_accessible_add_selection; - iface->remove_selection = gtk_label_accessible_remove_selection; - iface->set_selection = gtk_label_accessible_set_selection; - iface->get_character_extents = gtk_label_accessible_get_character_extents; - iface->get_offset_at_point = gtk_label_accessible_get_offset_at_point; - iface->get_run_attributes = gtk_label_accessible_get_run_attributes; - iface->get_default_attributes = gtk_label_accessible_get_default_attributes; -} - -/* AtkHypertext implementation {{{2 */ - -static AtkHyperlink * -gtk_label_accessible_get_link (AtkHypertext *hypertext, - int idx) -{ - GtkLabelAccessible *label = GTK_LABEL_ACCESSIBLE (hypertext); - GtkLabelAccessibleLinkImpl *impl; - - impl = (GtkLabelAccessibleLinkImpl *)g_list_nth_data (label->priv->links, idx); - - if (impl) - return ATK_HYPERLINK (impl->link); - - return NULL; -} - -static int -gtk_label_accessible_get_n_links (AtkHypertext *hypertext) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (hypertext)); - - return _gtk_label_get_n_links (GTK_LABEL (widget)); -} - -static int -gtk_label_accessible_get_link_index (AtkHypertext *hypertext, - int char_index) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (hypertext)); - - return _gtk_label_get_link_at (GTK_LABEL (widget), char_index); -} - -static void -atk_hypertext_interface_init (AtkHypertextIface *iface) -{ - iface->get_link = gtk_label_accessible_get_link; - iface->get_n_links = gtk_label_accessible_get_n_links; - iface->get_link_index = gtk_label_accessible_get_link_index; -} - -/* vim:set foldmethod=marker expandtab: */ diff --git a/gtk/a11y/gtklabelaccessible.h b/gtk/a11y/gtklabelaccessible.h deleted file mode 100644 index 886d34cf2c..0000000000 --- a/gtk/a11y/gtklabelaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_LABEL_ACCESSIBLE_H__ -#define __GTK_LABEL_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_LABEL_ACCESSIBLE (gtk_label_accessible_get_type ()) -#define GTK_LABEL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LABEL_ACCESSIBLE, GtkLabelAccessible)) -#define GTK_LABEL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LABEL_ACCESSIBLE, GtkLabelAccessibleClass)) -#define GTK_IS_LABEL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LABEL_ACCESSIBLE)) -#define GTK_IS_LABEL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LABEL_ACCESSIBLE)) -#define GTK_LABEL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LABEL_ACCESSIBLE, GtkLabelAccessibleClass)) - -typedef struct _GtkLabelAccessible GtkLabelAccessible; -typedef struct _GtkLabelAccessibleClass GtkLabelAccessibleClass; -typedef struct _GtkLabelAccessiblePrivate GtkLabelAccessiblePrivate; - -struct _GtkLabelAccessible -{ - GtkWidgetAccessible parent; - - GtkLabelAccessiblePrivate *priv; -}; - -struct _GtkLabelAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_label_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_LABEL_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtklabelaccessibleprivate.h b/gtk/a11y/gtklabelaccessibleprivate.h deleted file mode 100644 index bd8e8ca0cb..0000000000 --- a/gtk/a11y/gtklabelaccessibleprivate.h +++ /dev/null @@ -1,34 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_LABEL_ACCESSIBLE_PRIVATE_H__ -#define __GTK_LABEL_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtklabelaccessible.h> - -G_BEGIN_DECLS - -void _gtk_label_accessible_text_deleted (GtkLabel *label); -void _gtk_label_accessible_text_inserted (GtkLabel *label); -void _gtk_label_accessible_update_links (GtkLabel *label); -void _gtk_label_accessible_focus_link_changed (GtkLabel *label); -void _gtk_label_accessible_selection_bound_changed (GtkLabel *label); -void _gtk_label_accessible_cursor_position_changed (GtkLabel *label); - -G_END_DECLS - -#endif /* __GTK_LABEL_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtklevelbaraccessible.c b/gtk/a11y/gtklevelbaraccessible.c deleted file mode 100644 index cb25428710..0000000000 --- a/gtk/a11y/gtklevelbaraccessible.c +++ /dev/null @@ -1,178 +0,0 @@ -/* GAIL - The GNOME Accessibility Implementation Library - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * Copyright 2013 SUSE LLC. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtklevelbaraccessible.h" - -#include "gtklevelbar.h" - -#include <string.h> - -static void atk_value_interface_init (AtkValueIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkLevelBarAccessible, gtk_level_bar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) - -static void -on_value_changed (GObject *gobject, - GParamSpec *pspec, - gpointer user_data) -{ - GtkLevelBarAccessible *self = user_data; - - g_object_notify (G_OBJECT (self), "accessible-value"); -} - -static void -gtk_level_bar_accessible_initialize (AtkObject *object, - gpointer data) -{ - GtkLevelBar *level_bar = data; - - g_signal_connect (level_bar, "notify::value", G_CALLBACK (on_value_changed), object); -} - -static void -gtk_level_bar_accessible_class_init (GtkLevelBarAccessibleClass *klass) -{ - AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass); - - object_class->initialize = gtk_level_bar_accessible_initialize; -} - -static void -gtk_level_bar_accessible_init (GtkLevelBarAccessible *self) -{ - ATK_OBJECT (self)->role = ATK_ROLE_LEVEL_BAR; -} - -static void -gtk_level_bar_accessible_get_current_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkLevelBar *level_bar; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - level_bar = GTK_LEVEL_BAR (widget); - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_level_bar_get_value (level_bar)); -} - -static void -gtk_level_bar_accessible_get_maximum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkLevelBar *level_bar; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - level_bar = GTK_LEVEL_BAR (widget); - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_level_bar_get_max_value (level_bar)); -} - -static void -gtk_level_bar_accessible_get_minimum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkLevelBar *level_bar; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - level_bar = GTK_LEVEL_BAR (widget); - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_level_bar_get_min_value (level_bar)); -} - -static gboolean -gtk_level_bar_accessible_set_current_value (AtkValue *obj, - const GValue *value) -{ - GtkWidget *widget; - GtkLevelBar *level_bar; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - level_bar = GTK_LEVEL_BAR (widget); - - gtk_level_bar_set_value (level_bar, g_value_get_double (value)); - - return TRUE; -} - -static void -gtk_level_bar_accessible_get_value_and_text (AtkValue *obj, - double *value, - char **text) -{ - GtkWidget *widget; - GtkLevelBar *level_bar; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - level_bar = GTK_LEVEL_BAR (widget); - - *value = gtk_level_bar_get_value (level_bar); - *text = NULL; -} - -static AtkRange * -gtk_level_bar_accessible_get_range (AtkValue *obj) -{ - GtkWidget *widget; - GtkLevelBar *level_bar; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - level_bar = GTK_LEVEL_BAR (widget); - - return atk_range_new (gtk_level_bar_get_min_value (level_bar), - gtk_level_bar_get_max_value (level_bar), - NULL); -} - -static void -gtk_level_bar_accessible_set_value (AtkValue *obj, - const double value) -{ - GtkWidget *widget; - GtkLevelBar *level_bar; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - level_bar = GTK_LEVEL_BAR (widget); - - gtk_level_bar_set_value (level_bar, value); -} - -static void -atk_value_interface_init (AtkValueIface *iface) -{ - iface->get_current_value = gtk_level_bar_accessible_get_current_value; - iface->get_maximum_value = gtk_level_bar_accessible_get_maximum_value; - iface->get_minimum_value = gtk_level_bar_accessible_get_minimum_value; - iface->set_current_value = gtk_level_bar_accessible_set_current_value; - - iface->get_value_and_text = gtk_level_bar_accessible_get_value_and_text; - iface->get_range = gtk_level_bar_accessible_get_range; - iface->set_value = gtk_level_bar_accessible_set_value; -} diff --git a/gtk/a11y/gtklevelbaraccessible.h b/gtk/a11y/gtklevelbaraccessible.h deleted file mode 100644 index be037610ba..0000000000 --- a/gtk/a11y/gtklevelbaraccessible.h +++ /dev/null @@ -1,58 +0,0 @@ -/* GAIL - The GNOME Accessibility Implementation Library - * Copyright 2001 Sun Microsystems Inc. - * Copyright 2013 SUSE LLC. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_LEVEL_BAR_ACCESSIBLE_H__ -#define __GTK_LEVEL_BAR_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_LEVEL_BAR_ACCESSIBLE (gtk_level_bar_accessible_get_type ()) -#define GTK_LEVEL_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LEVEL_BAR_ACCESSIBLE, GtkLevelBarAccessible)) -#define GTK_LEVEL_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LEVEL_BAR_ACCESSIBLE, GtkLevelBarAccessibleClass)) -#define GTK_IS_LEVEL_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LEVEL_BAR_ACCESSIBLE)) -#define GTK_IS_LEVEL_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LEVEL_BAR_ACCESSIBLE)) -#define GTK_LEVEL_BAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LEVEL_BAR_ACCESSIBLE, GtkLevelBarAccessibleClass)) - -typedef struct _GtkLevelBarAccessible GtkLevelBarAccessible; -typedef struct _GtkLevelBarAccessibleClass GtkLevelBarAccessibleClass; -typedef struct _GtkLevelBarAccessiblePrivate GtkLevelBarAccessiblePrivate; - -struct _GtkLevelBarAccessible -{ - GtkWidgetAccessible parent; - - GtkLevelBarAccessiblePrivate *priv; -}; - -struct _GtkLevelBarAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_level_bar_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_LEVEL_BAR_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtklinkbuttonaccessible.c b/gtk/a11y/gtklinkbuttonaccessible.c deleted file mode 100644 index f5738a78d3..0000000000 --- a/gtk/a11y/gtklinkbuttonaccessible.c +++ /dev/null @@ -1,234 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2011 Red Hat, Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtklinkbuttonaccessible.h" - -typedef struct _GtkLinkButtonAccessibleLink GtkLinkButtonAccessibleLink; -typedef struct _GtkLinkButtonAccessibleLinkClass GtkLinkButtonAccessibleLinkClass; - -struct _GtkLinkButtonAccessiblePrivate -{ - AtkHyperlink *link; -}; - -struct _GtkLinkButtonAccessibleLink -{ - AtkHyperlink parent; - - GtkLinkButtonAccessible *button; -}; - -struct _GtkLinkButtonAccessibleLinkClass -{ - AtkHyperlinkClass parent_class; -}; - -static void atk_action_interface_init (AtkActionIface *iface); - -GType _gtk_link_button_accessible_link_get_type (void); - -G_DEFINE_TYPE_WITH_CODE (GtkLinkButtonAccessibleLink, _gtk_link_button_accessible_link, ATK_TYPE_HYPERLINK, - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - -static AtkHyperlink * -gtk_link_button_accessible_link_new (GtkLinkButtonAccessible *button) -{ - GtkLinkButtonAccessibleLink *l; - - l = g_object_new (_gtk_link_button_accessible_link_get_type (), NULL); - l->button = button; - - return ATK_HYPERLINK (l); -} - -static char * -gtk_link_button_accessible_link_get_uri (AtkHyperlink *atk_link, - int i) -{ - GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)atk_link; - GtkWidget *widget; - const char *uri; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (l->button)); - uri = gtk_link_button_get_uri (GTK_LINK_BUTTON (widget)); - - return g_strdup (uri); -} - -static int -gtk_link_button_accessible_link_get_n_anchors (AtkHyperlink *atk_link) -{ - return 1; -} - -static gboolean -gtk_link_button_accessible_link_is_valid (AtkHyperlink *atk_link) -{ - return TRUE; -} - -static AtkObject * -gtk_link_button_accessible_link_get_object (AtkHyperlink *atk_link, - int i) -{ - GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)atk_link; - - return ATK_OBJECT (l->button); -} - -static void -_gtk_link_button_accessible_link_init (GtkLinkButtonAccessibleLink *l) -{ -} - -static void -_gtk_link_button_accessible_link_class_init (GtkLinkButtonAccessibleLinkClass *class) -{ - AtkHyperlinkClass *atk_link_class = ATK_HYPERLINK_CLASS (class); - - atk_link_class->get_uri = gtk_link_button_accessible_link_get_uri; - atk_link_class->get_n_anchors = gtk_link_button_accessible_link_get_n_anchors; - atk_link_class->is_valid = gtk_link_button_accessible_link_is_valid; - atk_link_class->get_object = gtk_link_button_accessible_link_get_object; -} - -static gboolean -gtk_link_button_accessible_link_do_action (AtkAction *action, - int i) -{ - GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)action; - GtkWidget *widget; - - widget = GTK_WIDGET (l->button); - if (widget == NULL) - return FALSE; - - if (i != 0) - return FALSE; - - if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - g_signal_emit_by_name (widget, "clicked"); - - return TRUE; -} - -static int -gtk_link_button_accessible_link_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_link_button_accessible_link_get_name (AtkAction *action, - int i) -{ - if (i != 0) - return NULL; - - return "activate"; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_link_button_accessible_link_do_action; - iface->get_n_actions = gtk_link_button_accessible_link_get_n_actions; - iface->get_name = gtk_link_button_accessible_link_get_name; -} - -static gboolean -activate_link (GtkLinkButton *button, - AtkHyperlink *atk_link) -{ - g_signal_emit_by_name (atk_link, "link-activated"); - - return FALSE; -} - -static AtkHyperlink * -gtk_link_button_accessible_get_hyperlink (AtkHyperlinkImpl *impl) -{ - GtkLinkButtonAccessible *button = GTK_LINK_BUTTON_ACCESSIBLE (impl); - - if (!button->priv->link) - { - button->priv->link = gtk_link_button_accessible_link_new (button); - g_signal_connect (gtk_accessible_get_widget (GTK_ACCESSIBLE (button)), - "activate-link", G_CALLBACK (activate_link), button->priv->link); - } - - return g_object_ref (button->priv->link); -} - -static void atk_hypertext_impl_interface_init (AtkHyperlinkImplIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkLinkButtonAccessible, gtk_link_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE, - G_ADD_PRIVATE (GtkLinkButtonAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_HYPERLINK_IMPL, atk_hypertext_impl_interface_init)) - -static void -gtk_link_button_accessible_init (GtkLinkButtonAccessible *button) -{ - button->priv = gtk_link_button_accessible_get_instance_private (button); -} - -static void -gtk_link_button_accessible_finalize (GObject *object) -{ - GtkLinkButtonAccessible *button = GTK_LINK_BUTTON_ACCESSIBLE (object); - - if (button->priv->link) - g_object_unref (button->priv->link); - - G_OBJECT_CLASS (gtk_link_button_accessible_parent_class)->finalize (object); -} - -static AtkStateSet * -gtk_link_button_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - state_set = ATK_OBJECT_CLASS (gtk_link_button_accessible_parent_class)->ref_state_set (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget != NULL) - { - if (gtk_link_button_get_visited (GTK_LINK_BUTTON (widget))) - atk_state_set_add_state (state_set, ATK_STATE_VISITED); - } - - return state_set; -} - -static void -gtk_link_button_accessible_class_init (GtkLinkButtonAccessibleClass *klass) -{ - G_OBJECT_CLASS (klass)->finalize = gtk_link_button_accessible_finalize; - ATK_OBJECT_CLASS (klass)->ref_state_set = gtk_link_button_ref_state_set; -} - -static void -atk_hypertext_impl_interface_init (AtkHyperlinkImplIface *iface) -{ - iface->get_hyperlink = gtk_link_button_accessible_get_hyperlink; -} diff --git a/gtk/a11y/gtklinkbuttonaccessible.h b/gtk/a11y/gtklinkbuttonaccessible.h deleted file mode 100644 index afa52f9851..0000000000 --- a/gtk/a11y/gtklinkbuttonaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2011 Red Hat, Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_LINK_BUTTON_ACCESSIBLE_H__ -#define __GTK_LINK_BUTTON_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkbuttonaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_LINK_BUTTON_ACCESSIBLE (gtk_link_button_accessible_get_type ()) -#define GTK_LINK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessible)) -#define GTK_LINK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessibleClass)) -#define GTK_IS_LINK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE)) -#define GTK_IS_LINK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LINK_BUTTON_ACCESSIBLE)) -#define GTK_LINK_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessibleClass)) - -typedef struct _GtkLinkButtonAccessible GtkLinkButtonAccessible; -typedef struct _GtkLinkButtonAccessibleClass GtkLinkButtonAccessibleClass; -typedef struct _GtkLinkButtonAccessiblePrivate GtkLinkButtonAccessiblePrivate; - -struct _GtkLinkButtonAccessible -{ - GtkButtonAccessible parent; - - GtkLinkButtonAccessiblePrivate *priv; -}; - -struct _GtkLinkButtonAccessibleClass -{ - GtkButtonAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_link_button_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_LINK_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtklistboxaccessible.c b/gtk/a11y/gtklistboxaccessible.c deleted file mode 100644 index 6ee7801337..0000000000 --- a/gtk/a11y/gtklistboxaccessible.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtklistboxaccessibleprivate.h" - -#include "gtk/gtklistbox.h" - -static void atk_selection_interface_init (AtkSelectionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkListBoxAccessible, gtk_list_box_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) - -static void -gtk_list_box_accessible_init (GtkListBoxAccessible *accessible) -{ -} - -static void -gtk_list_box_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_list_box_accessible_parent_class)->initialize (obj, data); - - obj->role = ATK_ROLE_LIST_BOX; -} - -static AtkStateSet* -gtk_list_box_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - state_set = ATK_OBJECT_CLASS (gtk_list_box_accessible_parent_class)->ref_state_set (obj); - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - - if (widget != NULL) - atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS); - - return state_set; -} - -static void -gtk_list_box_accessible_class_init (GtkListBoxAccessibleClass *klass) -{ - AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass); - - object_class->initialize = gtk_list_box_accessible_initialize; - object_class->ref_state_set = gtk_list_box_accessible_ref_state_set; -} - -static gboolean -gtk_list_box_accessible_add_selection (AtkSelection *selection, - int idx) -{ - GtkWidget *box; - GtkListBoxRow *row; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (box), idx); - if (row) - { - gtk_list_box_select_row (GTK_LIST_BOX (box), row); - return TRUE; - } - return FALSE; -} - -static gboolean -gtk_list_box_accessible_remove_selection (AtkSelection *selection, - int idx) -{ - GtkWidget *box; - GtkListBoxRow *row; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (box), idx); - if (row) - { - gtk_list_box_unselect_row (GTK_LIST_BOX (box), row); - return TRUE; - } - return FALSE; -} - -static gboolean -gtk_list_box_accessible_clear_selection (AtkSelection *selection) -{ - GtkWidget *box; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - gtk_list_box_unselect_all (GTK_LIST_BOX (box)); - return TRUE; -} - -static gboolean -gtk_list_box_accessible_select_all (AtkSelection *selection) -{ - GtkWidget *box; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - gtk_list_box_select_all (GTK_LIST_BOX (box)); - return TRUE; -} - -typedef struct -{ - int idx; - GtkWidget *row; -} FindSelectedData; - -static void -find_selected_row (GtkListBox *box, - GtkListBoxRow *row, - gpointer data) -{ - FindSelectedData *d = data; - - if (d->idx == 0) - { - if (d->row == NULL) - d->row = GTK_WIDGET (row); - } - else - d->idx -= 1; -} - -static AtkObject * -gtk_list_box_accessible_ref_selection (AtkSelection *selection, - int idx) -{ - GtkWidget *box; - AtkObject *accessible; - FindSelectedData data; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return NULL; - - data.idx = idx; - data.row = NULL; - gtk_list_box_selected_foreach (GTK_LIST_BOX (box), find_selected_row, &data); - - if (data.row == NULL) - return NULL; - - accessible = gtk_widget_get_accessible (data.row); - g_object_ref (accessible); - return accessible; -} - -static void -count_selected (GtkListBox *box, - GtkListBoxRow *row, - gpointer data) -{ - int *count = data; - *count += 1; -} - -static int -gtk_list_box_accessible_get_selection_count (AtkSelection *selection) -{ - GtkWidget *box; - int count; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return 0; - - count = 0; - gtk_list_box_selected_foreach (GTK_LIST_BOX (box), count_selected, &count); - - return count; -} - -static gboolean -gtk_list_box_accessible_is_child_selected (AtkSelection *selection, - int idx) -{ - GtkWidget *box; - GtkListBoxRow *row; - - box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (box == NULL) - return FALSE; - - row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (box), idx); - - return gtk_list_box_row_is_selected (row); -} - -static void atk_selection_interface_init (AtkSelectionIface *iface) -{ - iface->add_selection = gtk_list_box_accessible_add_selection; - iface->remove_selection = gtk_list_box_accessible_remove_selection; - iface->clear_selection = gtk_list_box_accessible_clear_selection; - iface->ref_selection = gtk_list_box_accessible_ref_selection; - iface->get_selection_count = gtk_list_box_accessible_get_selection_count; - iface->is_child_selected = gtk_list_box_accessible_is_child_selected; - iface->select_all_selection = gtk_list_box_accessible_select_all; -} - -void -_gtk_list_box_accessible_selection_changed (GtkListBox *box) -{ - AtkObject *accessible; - accessible = gtk_widget_get_accessible (GTK_WIDGET (box)); - g_signal_emit_by_name (accessible, "selection-changed"); -} - -void -_gtk_list_box_accessible_update_cursor (GtkListBox *box, - GtkListBoxRow *row) -{ - AtkObject *accessible; - AtkObject *descendant; - accessible = gtk_widget_get_accessible (GTK_WIDGET (box)); - descendant = row ? gtk_widget_get_accessible (GTK_WIDGET (row)) : NULL; - g_signal_emit_by_name (accessible, "active-descendant-changed", descendant); -} diff --git a/gtk/a11y/gtklistboxaccessible.h b/gtk/a11y/gtklistboxaccessible.h deleted file mode 100644 index 2c168e9791..0000000000 --- a/gtk/a11y/gtklistboxaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#ifndef __GTK_LIST_BOX_ACCESSIBLE_H__ -#define __GTK_LIST_BOX_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_LIST_BOX_ACCESSIBLE (gtk_list_box_accessible_get_type ()) -#define GTK_LIST_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LIST_BOX_ACCESSIBLE, GtkListBoxAccessible)) -#define GTK_LIST_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LIST_BOX_ACCESSIBLE, GtkListBoxAccessibleClass)) -#define GTK_IS_LIST_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LIST_BOX_ACCESSIBLE)) -#define GTK_IS_LIST_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST_BOX_ACCESSIBLE)) -#define GTK_LIST_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LIST_BOX_ACCESSIBLE, GtkListBoxAccessibleClass)) - -typedef struct _GtkListBoxAccessible GtkListBoxAccessible; -typedef struct _GtkListBoxAccessibleClass GtkListBoxAccessibleClass; -typedef struct _GtkListBoxAccessiblePrivate GtkListBoxAccessiblePrivate; - -struct _GtkListBoxAccessible -{ - GtkWidgetAccessible parent; - - GtkListBoxAccessiblePrivate *priv; -}; - -struct _GtkListBoxAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_list_box_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_LIST_BOX_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtklistboxaccessibleprivate.h b/gtk/a11y/gtklistboxaccessibleprivate.h deleted file mode 100644 index 2ea0de7982..0000000000 --- a/gtk/a11y/gtklistboxaccessibleprivate.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#ifndef __GTK_LIST_BOX_ACCESSIBLE_PRIVATE_H__ -#define __GTK_LIST_BOX_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtklistboxaccessible.h> - -#include <gtk/gtklistbox.h> - -G_BEGIN_DECLS - -void _gtk_list_box_accessible_update_cursor (GtkListBox *box, - GtkListBoxRow *row); -void _gtk_list_box_accessible_selection_changed (GtkListBox *box); - -G_END_DECLS - -#endif /* __GTK_LIST_BOX_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtklistboxrowaccessible.c b/gtk/a11y/gtklistboxrowaccessible.c deleted file mode 100644 index 6a37efb1a5..0000000000 --- a/gtk/a11y/gtklistboxrowaccessible.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtklistboxrowaccessible.h" - -#include "gtk/gtklistbox.h" - - -G_DEFINE_TYPE (GtkListBoxRowAccessible, gtk_list_box_row_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static void -gtk_list_box_row_accessible_init (GtkListBoxRowAccessible *accessible) -{ -} - -static void -gtk_list_box_row_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_list_box_row_accessible_parent_class)->initialize (obj, data); - - obj->role = ATK_ROLE_LIST_ITEM; -} - -static AtkStateSet* -gtk_list_box_row_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget, *parent; - - state_set = ATK_OBJECT_CLASS (gtk_list_box_row_accessible_parent_class)->ref_state_set (obj); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget != NULL) - { - parent = gtk_widget_get_parent (widget); - if (parent != NULL && - GTK_IS_LIST_BOX (parent) && - gtk_list_box_get_selection_mode (GTK_LIST_BOX (parent)) != GTK_SELECTION_NONE) - atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE); - - if (gtk_list_box_row_is_selected (GTK_LIST_BOX_ROW (widget))) - atk_state_set_add_state (state_set, ATK_STATE_SELECTED); - } - - return state_set; -} - -static void -gtk_list_box_row_accessible_class_init (GtkListBoxRowAccessibleClass *klass) -{ - AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass); - - object_class->initialize = gtk_list_box_row_accessible_initialize; - object_class->ref_state_set = gtk_list_box_row_accessible_ref_state_set; -} diff --git a/gtk/a11y/gtklistboxrowaccessible.h b/gtk/a11y/gtklistboxrowaccessible.h deleted file mode 100644 index 47a561c0c5..0000000000 --- a/gtk/a11y/gtklistboxrowaccessible.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2013 Red Hat, Inc. - * - * 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 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/>. - */ - -#ifndef __GTK_LIST_BOX_ROW_ACCESSIBLE_H__ -#define __GTK_LIST_BOX_ROW_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE (gtk_list_box_row_accessible_get_type ()) -#define GTK_LIST_BOX_ROW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE, GtkListBoxRowAccessible)) -#define GTK_LIST_BOX_ROW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE, GtkListBoxRowAccessibleClass)) -#define GTK_IS_LIST_BOX_ROW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE)) -#define GTK_IS_LIST_BOX_ROW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE)) -#define GTK_LIST_BOX_ROW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE, GtkListBoxRowAccessibleClass)) - -typedef struct _GtkListBoxRowAccessible GtkListBoxRowAccessible; -typedef struct _GtkListBoxRowAccessibleClass GtkListBoxRowAccessibleClass; - -struct _GtkListBoxRowAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkListBoxRowAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_list_box_row_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_LIST_BOX_ROW_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtklockbuttonaccessible.c b/gtk/a11y/gtklockbuttonaccessible.c deleted file mode 100644 index a7b878838c..0000000000 --- a/gtk/a11y/gtklockbuttonaccessible.c +++ /dev/null @@ -1,63 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtklockbuttonaccessibleprivate.h" - -#include "gtk/gtklockbuttonprivate.h" -#include "gtk/gtkwidgetprivate.h" - -G_DEFINE_TYPE (GtkLockButtonAccessible, gtk_lock_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE) - -static const char * -gtk_lock_button_accessible_get_name (AtkObject *obj) -{ - GtkLockButton *lockbutton; - - lockbutton = GTK_LOCK_BUTTON (gtk_accessible_get_widget (GTK_ACCESSIBLE (obj))); - if (lockbutton == NULL) - return NULL; - - return _gtk_lock_button_get_current_text (lockbutton); -} - -static void -gtk_lock_button_accessible_class_init (GtkLockButtonAccessibleClass *klass) -{ - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - - atk_object_class->get_name = gtk_lock_button_accessible_get_name; -} - -static void -gtk_lock_button_accessible_init (GtkLockButtonAccessible *lockbutton) -{ -} - -void -_gtk_lock_button_accessible_name_changed (GtkLockButton *lockbutton) -{ - AtkObject *obj; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (lockbutton)); - if (obj == NULL) - return; - - g_object_notify (G_OBJECT (obj), "accessible-name"); -} - diff --git a/gtk/a11y/gtklockbuttonaccessible.h b/gtk/a11y/gtklockbuttonaccessible.h deleted file mode 100644 index d6b4510c7d..0000000000 --- a/gtk/a11y/gtklockbuttonaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_LOCK_BUTTON_ACCESSIBLE_H__ -#define __GTK_LOCK_BUTTON_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkbuttonaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_LOCK_BUTTON_ACCESSIBLE (gtk_lock_button_accessible_get_type ()) -#define GTK_LOCK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE, GtkLockButtonAccessible)) -#define GTK_LOCK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE, GtkLockButtonAccessibleClass)) -#define GTK_IS_LOCK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE)) -#define GTK_IS_LOCK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE)) -#define GTK_LOCK_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE, GtkLockButtonAccessibleClass)) - -typedef struct _GtkLockButtonAccessible GtkLockButtonAccessible; -typedef struct _GtkLockButtonAccessibleClass GtkLockButtonAccessibleClass; -typedef struct _GtkLockButtonAccessiblePrivate GtkLockButtonAccessiblePrivate; - -struct _GtkLockButtonAccessible -{ - GtkButtonAccessible parent; - - GtkLockButtonAccessiblePrivate *priv; -}; - -struct _GtkLockButtonAccessibleClass -{ - GtkButtonAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_lock_button_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_LOCK_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtklockbuttonaccessibleprivate.h b/gtk/a11y/gtklockbuttonaccessibleprivate.h deleted file mode 100644 index 6ba82e425a..0000000000 --- a/gtk/a11y/gtklockbuttonaccessibleprivate.h +++ /dev/null @@ -1,31 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_LOCK_BUTTON_ACCESSIBLE_PRIVATE_H__ -#define __GTK_LOCK_BUTTON_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtklockbuttonaccessible.h> - -#include <gtk/gtklockbutton.h> - -G_BEGIN_DECLS - -void _gtk_lock_button_accessible_name_changed (GtkLockButton *lockbutton); - -G_END_DECLS - -#endif /* __GTK_LOCK_BUTTON_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtkmenubuttonaccessible.c b/gtk/a11y/gtkmenubuttonaccessible.c deleted file mode 100644 index cdd2792e06..0000000000 --- a/gtk/a11y/gtkmenubuttonaccessible.c +++ /dev/null @@ -1,117 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include <glib/gi18n-lib.h> -#include "gtkmenubuttonaccessible.h" - - -G_DEFINE_TYPE (GtkMenuButtonAccessible, gtk_menu_button_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static void -gtk_menu_button_accessible_initialize (AtkObject *accessible, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_menu_button_accessible_parent_class)->initialize (accessible, data); - - accessible->role = ATK_ROLE_TOGGLE_BUTTON; -} - -static int -gtk_menu_button_accessible_get_n_children (AtkObject* obj) -{ - GtkWidget *widget; - int count = 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return count; - - return count; -} - -static AtkObject * -gtk_menu_button_accessible_ref_child (AtkObject *obj, - int i) -{ - AtkObject *accessible = NULL; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - return accessible; -} - -static const char * -gtk_menu_button_accessible_get_name (AtkObject *obj) -{ - const char *name = NULL; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - name = ATK_OBJECT_CLASS (gtk_menu_button_accessible_parent_class)->get_name (obj); - if (name != NULL) - return name; - - return _("Menu"); -} - -static AtkStateSet * -gtk_menu_button_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget; - GtkWidget *button; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - button = gtk_widget_get_first_child (widget); - - state_set = ATK_OBJECT_CLASS (gtk_menu_button_accessible_parent_class)->ref_state_set (obj); - - atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); - if (gtk_widget_has_focus (button)) - atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); - - return state_set; -} - -static void -gtk_menu_button_accessible_class_init (GtkMenuButtonAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_name = gtk_menu_button_accessible_get_name; - class->initialize = gtk_menu_button_accessible_initialize; - class->get_n_children = gtk_menu_button_accessible_get_n_children; - class->ref_child = gtk_menu_button_accessible_ref_child; - class->ref_state_set = gtk_menu_button_accessible_ref_state_set; -} - -static void -gtk_menu_button_accessible_init (GtkMenuButtonAccessible *menu_button) -{ -} diff --git a/gtk/a11y/gtkmenubuttonaccessible.h b/gtk/a11y/gtkmenubuttonaccessible.h deleted file mode 100644 index 17168a2eb7..0000000000 --- a/gtk/a11y/gtkmenubuttonaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_MENU_BUTTON_ACCESSIBLE_H__ -#define __GTK_MENU_BUTTON_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_MENU_BUTTON_ACCESSIBLE (gtk_menu_button_accessible_get_type ()) -#define GTK_MENU_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_BUTTON_ACCESSIBLE, GtkMenuButtonAccessible)) -#define GTK_MENU_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_BUTTON_ACCESSIBLE, GtkMenuButtonAccessibleClass)) -#define GTK_IS_MENU_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_BUTTON_ACCESSIBLE)) -#define GTK_IS_MENU_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_BUTTON_ACCESSIBLE)) -#define GTK_MENU_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_BUTTON_ACCESSIBLE, GtkMenuButtonAccessibleClass)) - -typedef struct _GtkMenuButtonAccessible GtkMenuButtonAccessible; -typedef struct _GtkMenuButtonAccessibleClass GtkMenuButtonAccessibleClass; -typedef struct _GtkMenuButtonAccessiblePrivate GtkMenuButtonAccessiblePrivate; - -struct _GtkMenuButtonAccessible -{ - GtkWidgetAccessible parent; - - GtkMenuButtonAccessiblePrivate *priv; -}; - -struct _GtkMenuButtonAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_menu_button_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_MENU_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtknotebookaccessible.c b/gtk/a11y/gtknotebookaccessible.c deleted file mode 100644 index 9fb930cd4e..0000000000 --- a/gtk/a11y/gtknotebookaccessible.c +++ /dev/null @@ -1,312 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtknotebookaccessibleprivate.h" - -#include "gtknotebookpageaccessible.h" -#include "gtknotebook.h" - -#include <string.h> - -struct _GtkNotebookAccessiblePrivate -{ - /* - * page_cache maintains a list of pre-ref'd Notebook Pages. - * This cache is queried by gtk_notebook_accessible_ref_child(). - * If the page is found in the list then a new page does not - * need to be created - */ - GHashTable * pages; - int selected_page; -}; - -static void atk_selection_interface_init (AtkSelectionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkNotebookAccessible, gtk_notebook_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkNotebookAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)) - -static void -create_notebook_page_accessible (GtkNotebookAccessible *accessible, - GtkNotebook *notebook, - GtkWidget *child, - int page_num) -{ - AtkObject *obj; - - obj = gtk_notebook_page_accessible_new (accessible, child); - g_hash_table_insert (accessible->priv->pages, child, obj); - atk_object_set_parent (obj, ATK_OBJECT (accessible)); - g_signal_emit_by_name (accessible, "children-changed::add", page_num, obj, NULL); -} - -static void -page_added_cb (GtkNotebook *notebook, - GtkWidget *child, - guint page_num, - gpointer data) -{ - AtkObject *atk_obj; - GtkNotebookAccessible *accessible; - - atk_obj = gtk_widget_get_accessible (GTK_WIDGET (notebook)); - accessible = GTK_NOTEBOOK_ACCESSIBLE (atk_obj); - create_notebook_page_accessible (accessible, notebook, child, page_num); -} - -static void -page_removed_cb (GtkNotebook *notebook, - GtkWidget *widget, - guint page_num, - gpointer data) -{ - GtkNotebookAccessible *accessible; - AtkObject *obj; - - accessible = GTK_NOTEBOOK_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (notebook))); - - obj = g_hash_table_lookup (accessible->priv->pages, widget); - g_return_if_fail (obj); - g_signal_emit_by_name (accessible, "children-changed::remove", - page_num, obj, NULL); - gtk_notebook_page_accessible_invalidate (GTK_NOTEBOOK_PAGE_ACCESSIBLE (obj)); - g_hash_table_remove (accessible->priv->pages, widget); -} - - -static void -gtk_notebook_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkNotebookAccessible *accessible; - GtkNotebook *notebook; - int i; - - ATK_OBJECT_CLASS (gtk_notebook_accessible_parent_class)->initialize (obj, data); - - accessible = GTK_NOTEBOOK_ACCESSIBLE (obj); - notebook = GTK_NOTEBOOK (data); - for (i = 0; i < gtk_notebook_get_n_pages (notebook); i++) - { - create_notebook_page_accessible (accessible, - notebook, - gtk_notebook_get_nth_page (notebook, i), - i); - } - accessible->priv->selected_page = gtk_notebook_get_current_page (notebook); - - g_signal_connect (notebook, "page-added", - G_CALLBACK (page_added_cb), NULL); - g_signal_connect (notebook, "page-removed", - G_CALLBACK (page_removed_cb), NULL); - - obj->role = ATK_ROLE_PAGE_TAB_LIST; -} - -static void -gtk_notebook_accessible_finalize (GObject *object) -{ - GtkNotebookAccessible *accessible = GTK_NOTEBOOK_ACCESSIBLE (object); - - g_hash_table_destroy (accessible->priv->pages); - - G_OBJECT_CLASS (gtk_notebook_accessible_parent_class)->finalize (object); -} - -static AtkObject * -gtk_notebook_accessible_ref_child (AtkObject *obj, - int i) -{ - AtkObject *child; - GtkNotebookAccessible *accessible; - GtkNotebook *notebook; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - accessible = GTK_NOTEBOOK_ACCESSIBLE (obj); - notebook = GTK_NOTEBOOK (widget); - - child = g_hash_table_lookup (accessible->priv->pages, - gtk_notebook_get_nth_page (notebook, i)); - /* can return NULL when i >= n_children */ - - if (child) - g_object_ref (child); - - return child; -} - -void -gtk_notebook_accessible_update_page (GtkNotebookAccessible *self, - int page_num) -{ - GtkNotebookAccessiblePrivate *priv = gtk_notebook_accessible_get_instance_private (self); - AtkObject *atk_obj = ATK_OBJECT (self); - int old_page_num = priv->selected_page; - - priv->selected_page = page_num; - - /* Notify SELECTED state change for old and new page */ - if (page_num != old_page_num) - { - AtkObject *child; - - if (old_page_num != -1) - { - child = gtk_notebook_accessible_ref_child (atk_obj, old_page_num); - if (child != NULL) - { - atk_object_notify_state_change (child, ATK_STATE_SELECTED, FALSE); - g_object_unref (child); - } - } - - child = gtk_notebook_accessible_ref_child (atk_obj, page_num); - if (child != NULL) - { - atk_object_notify_state_change (child, ATK_STATE_SELECTED, TRUE); - g_object_unref (child); - } - - g_signal_emit_by_name (atk_obj, "selection-changed"); - g_signal_emit_by_name (atk_obj, "visible-data-changed"); - } -} - -/* - * GtkNotebook only supports the selection of one page at a time. - * Selecting a page unselects any previous selection, so this - * changes the current selection instead of adding to it. - */ -static gboolean -gtk_notebook_accessible_add_selection (AtkSelection *selection, - int i) -{ - GtkNotebook *notebook; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - notebook = GTK_NOTEBOOK (widget); - gtk_notebook_set_current_page (notebook, i); - return TRUE; -} - -static void -gtk_notebook_accessible_class_init (GtkNotebookAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - gobject_class->finalize = gtk_notebook_accessible_finalize; - - class->ref_child = gtk_notebook_accessible_ref_child; - class->initialize = gtk_notebook_accessible_initialize; -} - -static void -gtk_notebook_accessible_init (GtkNotebookAccessible *notebook) -{ - notebook->priv = gtk_notebook_accessible_get_instance_private (notebook); - notebook->priv->pages = g_hash_table_new_full (g_direct_hash, - g_direct_equal, - NULL, - g_object_unref); - notebook->priv->selected_page = -1; -} - -static AtkObject * -gtk_notebook_accessible_ref_selection (AtkSelection *selection, - int i) -{ - AtkObject *accessible; - GtkWidget *widget; - GtkNotebook *notebook; - int pagenum; - - if (i != 0) - return NULL; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return NULL; - - notebook = GTK_NOTEBOOK (widget); - pagenum = gtk_notebook_get_current_page (notebook); - if (pagenum == -1) - return NULL; - accessible = gtk_notebook_accessible_ref_child (ATK_OBJECT (selection), pagenum); - - return accessible; -} - -/* Always return 1 because there can only be one page - * selected at any time - */ -static int -gtk_notebook_accessible_get_selection_count (AtkSelection *selection) -{ - GtkWidget *widget; - GtkNotebook *notebook; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return 0; - - notebook = GTK_NOTEBOOK (widget); - if (notebook == NULL || gtk_notebook_get_current_page (notebook) == -1) - return 0; - - return 1; -} - -static gboolean -gtk_notebook_accessible_is_child_selected (AtkSelection *selection, - int i) -{ - GtkWidget *widget; - GtkNotebook *notebook; - int pagenumber; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - notebook = GTK_NOTEBOOK (widget); - pagenumber = gtk_notebook_get_current_page(notebook); - - if (pagenumber == i) - return TRUE; - - return FALSE; -} - -static void -atk_selection_interface_init (AtkSelectionIface *iface) -{ - iface->add_selection = gtk_notebook_accessible_add_selection; - iface->ref_selection = gtk_notebook_accessible_ref_selection; - iface->get_selection_count = gtk_notebook_accessible_get_selection_count; - iface->is_child_selected = gtk_notebook_accessible_is_child_selected; -} diff --git a/gtk/a11y/gtknotebookaccessible.h b/gtk/a11y/gtknotebookaccessible.h deleted file mode 100644 index bd34be6902..0000000000 --- a/gtk/a11y/gtknotebookaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_NOTEBOOK_ACCESSIBLE_H__ -#define __GTK_NOTEBOOK_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_NOTEBOOK_ACCESSIBLE (gtk_notebook_accessible_get_type ()) -#define GTK_NOTEBOOK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_NOTEBOOK_ACCESSIBLE, GtkNotebookAccessible)) -#define GTK_NOTEBOOK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK_ACCESSIBLE, GtkNotebookAccessibleClass)) -#define GTK_IS_NOTEBOOK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NOTEBOOK_ACCESSIBLE)) -#define GTK_IS_NOTEBOOK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK_ACCESSIBLE)) -#define GTK_NOTEBOOK_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK_ACCESSIBLE, GtkNotebookAccessibleClass)) - -typedef struct _GtkNotebookAccessible GtkNotebookAccessible; -typedef struct _GtkNotebookAccessibleClass GtkNotebookAccessibleClass; -typedef struct _GtkNotebookAccessiblePrivate GtkNotebookAccessiblePrivate; - -struct _GtkNotebookAccessible -{ - GtkWidgetAccessible parent; - - GtkNotebookAccessiblePrivate *priv; -}; - -struct _GtkNotebookAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_notebook_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_NOTEBOOK_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtknotebookaccessibleprivate.h b/gtk/a11y/gtknotebookaccessibleprivate.h deleted file mode 100644 index 5e4ab3b9f5..0000000000 --- a/gtk/a11y/gtknotebookaccessibleprivate.h +++ /dev/null @@ -1,30 +0,0 @@ -/* gtknotebookaccessibleprivate.h: GtkNotebookAccessible private API - * - * 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/>. - */ - -#pragma once - -#include "gtknotebookaccessible.h" - -G_BEGIN_DECLS - -void gtk_notebook_accessible_update_page (GtkNotebookAccessible *self, - int page_num); - -G_END_DECLS diff --git a/gtk/a11y/gtknotebookpageaccessible.c b/gtk/a11y/gtknotebookpageaccessible.c deleted file mode 100644 index 0d8c37ce9e..0000000000 --- a/gtk/a11y/gtknotebookpageaccessible.c +++ /dev/null @@ -1,334 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtknotebookpageaccessible.h" - - -struct _GtkNotebookPageAccessiblePrivate -{ - GtkAccessible *notebook; - GtkWidget *child; -}; - -static void atk_component_interface_init (AtkComponentIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkNotebookPageAccessible, gtk_notebook_page_accessible, ATK_TYPE_OBJECT, - G_ADD_PRIVATE (GtkNotebookPageAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)) - - -static GtkWidget * -find_label_child (GtkWidget *widget) -{ - GtkWidget *child; - - for (child = gtk_widget_get_first_child (widget); - child != NULL; - child = gtk_widget_get_next_sibling (child)) - { - if (GTK_IS_LABEL (child)) - return child; - else - { - GtkWidget *w = find_label_child (child); - if (w) - return w; - } - } - - return NULL; -} - -static GtkWidget * -get_label_from_notebook_page (GtkNotebookPageAccessible *page) -{ - GtkWidget *child; - GtkNotebook *notebook; - - notebook = GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook)); - if (!notebook) - return NULL; - - if (!gtk_notebook_get_show_tabs (notebook)) - return NULL; - - child = gtk_notebook_get_tab_label (notebook, page->priv->child); - - if (GTK_IS_LABEL (child)) - return child; - - return find_label_child (child); -} - -static const char * -gtk_notebook_page_accessible_get_name (AtkObject *accessible) -{ - GtkWidget *label; - - if (accessible->name != NULL) - return accessible->name; - - label = get_label_from_notebook_page (GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible)); - if (GTK_IS_LABEL (label)) - return gtk_label_get_text (GTK_LABEL (label)); - - return NULL; -} - -static AtkObject * -gtk_notebook_page_accessible_get_parent (AtkObject *accessible) -{ - GtkNotebookPageAccessible *page; - - page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible); - - return ATK_OBJECT (page->priv->notebook); -} - -static int -gtk_notebook_page_accessible_get_n_children (AtkObject *accessible) -{ - return 1; -} - -static AtkObject * -gtk_notebook_page_accessible_ref_child (AtkObject *accessible, - int i) -{ - AtkObject *child_obj; - GtkNotebookPageAccessible *page = NULL; - - if (i != 0) - return NULL; - - page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible); - if (!page->priv->child) - return NULL; - - child_obj = gtk_widget_get_accessible (page->priv->child); - g_object_ref (child_obj); - - return child_obj; -} - -static AtkStateSet * -gtk_notebook_page_accessible_ref_state_set (AtkObject *accessible) -{ - GtkNotebookPageAccessible *page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible); - AtkStateSet *state_set, *label_state_set, *merged_state_set; - AtkObject *atk_label; - GtkWidget *label; - AtkObject *selected; - - state_set = ATK_OBJECT_CLASS (gtk_notebook_page_accessible_parent_class)->ref_state_set (accessible); - - atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE); - - selected = atk_selection_ref_selection (ATK_SELECTION (page->priv->notebook), 0); - if (selected) - { - if (selected == accessible) - atk_state_set_add_state (state_set, ATK_STATE_SELECTED); - - g_object_unref (selected); - } - - label = get_label_from_notebook_page (GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible)); - if (label) - { - atk_label = gtk_widget_get_accessible (label); - label_state_set = atk_object_ref_state_set (atk_label); - merged_state_set = atk_state_set_or_sets (state_set, label_state_set); - g_object_unref (label_state_set); - g_object_unref (state_set); - } - else - { - AtkObject *child; - - child = atk_object_ref_accessible_child (accessible, 0); - if (!child) - return state_set; - - merged_state_set = state_set; - state_set = atk_object_ref_state_set (child); - if (atk_state_set_contains_state (state_set, ATK_STATE_VISIBLE)) - { - atk_state_set_add_state (merged_state_set, ATK_STATE_VISIBLE); - if (atk_state_set_contains_state (state_set, ATK_STATE_ENABLED)) - atk_state_set_add_state (merged_state_set, ATK_STATE_ENABLED); - if (atk_state_set_contains_state (state_set, ATK_STATE_SHOWING)) - atk_state_set_add_state (merged_state_set, ATK_STATE_SHOWING); - - } - g_object_unref (state_set); - g_object_unref (child); - } - return merged_state_set; -} - -static int -gtk_notebook_page_accessible_get_index_in_parent (AtkObject *accessible) -{ - GtkNotebookPageAccessible *page; - - page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible); - if (!page->priv->child) - return -1; - - return gtk_notebook_page_num (GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook)), - page->priv->child); -} - -static void -gtk_notebook_page_accessible_class_init (GtkNotebookPageAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_name = gtk_notebook_page_accessible_get_name; - class->get_parent = gtk_notebook_page_accessible_get_parent; - class->get_n_children = gtk_notebook_page_accessible_get_n_children; - class->ref_child = gtk_notebook_page_accessible_ref_child; - class->ref_state_set = gtk_notebook_page_accessible_ref_state_set; - class->get_index_in_parent = gtk_notebook_page_accessible_get_index_in_parent; -} - -static void -gtk_notebook_page_accessible_init (GtkNotebookPageAccessible *page) -{ - page->priv = gtk_notebook_page_accessible_get_instance_private (page); -} - -static void -notify_tab_label (GObject *object, - GParamSpec *pspec, - AtkObject *atk_obj) -{ - if (atk_obj->name == NULL) - g_object_notify (G_OBJECT (atk_obj), "accessible-name"); - g_signal_emit_by_name (atk_obj, "visible-data-changed"); -} - -AtkObject * -gtk_notebook_page_accessible_new (GtkNotebookAccessible *notebook, - GtkWidget *child) -{ - GObject *object; - AtkObject *atk_object; - GtkNotebookPageAccessible *page; - GtkNotebook *nb; - - g_return_val_if_fail (GTK_IS_NOTEBOOK_ACCESSIBLE (notebook), NULL); - g_return_val_if_fail (GTK_WIDGET (child), NULL); - - object = g_object_new (GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, NULL); - - page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (object); - page->priv->notebook = GTK_ACCESSIBLE (notebook); - page->priv->child = child; - - atk_object = ATK_OBJECT (page); - atk_object->role = ATK_ROLE_PAGE_TAB; - atk_object->layer = ATK_LAYER_WIDGET; - - atk_object_set_parent (gtk_widget_get_accessible (child), atk_object); - nb = GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook)); - - g_signal_connect (gtk_notebook_get_page (nb, child), - "notify::tab-label", - G_CALLBACK (notify_tab_label), page); - - return atk_object; -} - -void -gtk_notebook_page_accessible_invalidate (GtkNotebookPageAccessible *page) -{ - AtkObject *obj = ATK_OBJECT (page); - GtkWidget *notebook; - - notebook = gtk_accessible_get_widget (page->priv->notebook); - if (notebook) - g_signal_handlers_disconnect_by_func (notebook, notify_tab_label, page); - - atk_object_notify_state_change (obj, ATK_STATE_DEFUNCT, TRUE); - atk_object_set_parent (obj, NULL); - page->priv->notebook = NULL; - atk_object_set_parent (gtk_widget_get_accessible (page->priv->child), NULL); - page->priv->child = NULL; -} - -static AtkObject* -gtk_notebook_page_accessible_ref_accessible_at_point (AtkComponent *component, - int x, - int y, - AtkCoordType coord_type) -{ - /* There is only one child so we return it */ - AtkObject* child; - - child = atk_object_ref_accessible_child (ATK_OBJECT (component), 0); - - return child; -} - -static void -gtk_notebook_page_accessible_get_extents (AtkComponent *component, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkWidget *label; - AtkObject *atk_label; - - label = get_label_from_notebook_page (GTK_NOTEBOOK_PAGE_ACCESSIBLE (component)); - if (!label) - { - AtkObject *child; - - *width = 0; - *height = 0; - - child = atk_object_ref_accessible_child (ATK_OBJECT (component), 0); - if (!child) - return; - - atk_component_get_extents (ATK_COMPONENT (child), x, y, NULL, NULL, - coord_type); - g_object_unref (child); - } - else - { - atk_label = gtk_widget_get_accessible (label); - atk_component_get_extents (ATK_COMPONENT (atk_label), - x, y, width, height, coord_type); - } -} - -static void -atk_component_interface_init (AtkComponentIface *iface) -{ - /* We use the default implementations for contains, get_position, get_size */ - iface->ref_accessible_at_point = gtk_notebook_page_accessible_ref_accessible_at_point; - iface->get_extents = gtk_notebook_page_accessible_get_extents; -} diff --git a/gtk/a11y/gtknotebookpageaccessible.h b/gtk/a11y/gtknotebookpageaccessible.h deleted file mode 100644 index dfa6d6df4a..0000000000 --- a/gtk/a11y/gtknotebookpageaccessible.h +++ /dev/null @@ -1,64 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_NOTEBOOK_PAGE_ACCESSIBLE_H__ -#define __GTK_NOTEBOOK_PAGE_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtknotebookaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE (gtk_notebook_page_accessible_get_type ()) -#define GTK_NOTEBOOK_PAGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, GtkNotebookPageAccessible)) -#define GTK_NOTEBOOK_PAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, GtkNotebookPageAccessibleClass)) -#define GTK_IS_NOTEBOOK_PAGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE)) -#define GTK_IS_NOTEBOOK_PAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE)) -#define GTK_NOTEBOOK_PAGE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, GtkNotebookPageAccessibleClass)) - -typedef struct _GtkNotebookPageAccessible GtkNotebookPageAccessible; -typedef struct _GtkNotebookPageAccessibleClass GtkNotebookPageAccessibleClass; -typedef struct _GtkNotebookPageAccessiblePrivate GtkNotebookPageAccessiblePrivate; - -struct _GtkNotebookPageAccessible -{ - AtkObject parent; - - GtkNotebookPageAccessiblePrivate *priv; -}; - -struct _GtkNotebookPageAccessibleClass -{ - AtkObjectClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_notebook_page_accessible_get_type (void); - -GDK_AVAILABLE_IN_ALL -AtkObject *gtk_notebook_page_accessible_new (GtkNotebookAccessible *notebook, - GtkWidget *child); - -GDK_AVAILABLE_IN_ALL -void gtk_notebook_page_accessible_invalidate (GtkNotebookPageAccessible *page); - -G_END_DECLS - -#endif /* __GTK_NOTEBOOK_PAGE_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkpanedaccessible.c b/gtk/a11y/gtkpanedaccessible.c deleted file mode 100644 index 97793626ab..0000000000 --- a/gtk/a11y/gtkpanedaccessible.c +++ /dev/null @@ -1,200 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtkpanedaccessible.h" - -static void atk_value_interface_init (AtkValueIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) - -static void -gtk_paned_accessible_position_changed (GtkWidget *widget) -{ - AtkObject *obj = gtk_widget_get_accessible (widget); - - g_object_notify (G_OBJECT (obj), "accessible-value"); -} - -static void -gtk_paned_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_paned_accessible_parent_class)->initialize (obj, data); - - g_signal_connect (data, "notify::position", - G_CALLBACK (gtk_paned_accessible_position_changed), NULL); - - obj->role = ATK_ROLE_SPLIT_PANE; -} - -static void -gtk_paned_accessible_class_init (GtkPanedAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->initialize = gtk_paned_accessible_initialize; -} - -static void -gtk_paned_accessible_init (GtkPanedAccessible *paned) -{ -} - -static void -gtk_paned_accessible_get_current_value (AtkValue *obj, - GValue *value) -{ - GtkWidget* widget; - int current_value; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return; - - current_value = gtk_paned_get_position (GTK_PANED (widget)); - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_INT); - g_value_set_int (value, current_value); -} - -static void -gtk_paned_accessible_get_maximum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget* widget; - int maximum_value; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return; - - g_object_get (GTK_PANED (widget), - "max-position", &maximum_value, - NULL); - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_INT); - g_value_set_int (value, maximum_value); -} - -static void -gtk_paned_accessible_get_minimum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget* widget; - int minimum_value; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return; - - g_object_get (GTK_PANED (widget), - "min-position", &minimum_value, - NULL); - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_INT); - g_value_set_int (value, minimum_value); -} - -/* Calling atk_value_set_current_value() is no guarantee that the value - * is acceptable; it is necessary to listen for accessible-value signals - * and check whether the current value has been changed or check what the - * maximum and minimum values are. - */ -static gboolean -gtk_paned_accessible_set_current_value (AtkValue *obj, - const GValue *value) -{ - GtkWidget* widget; - int new_value; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return FALSE; - - if (G_VALUE_HOLDS_INT (value)) - { - new_value = g_value_get_int (value); - gtk_paned_set_position (GTK_PANED (widget), new_value); - - return TRUE; - } - else - return FALSE; -} - -static void -gtk_paned_accessible_get_value_and_text (AtkValue *obj, - double *value, - char **text) -{ - GtkWidget *widget; - GtkPaned *paned; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - paned = GTK_PANED (widget); - - *value = gtk_paned_get_position (paned); - *text = NULL; -} - -static AtkRange * -gtk_paned_accessible_get_range (AtkValue *obj) -{ - GtkWidget *widget; - int minimum_value; - int maximum_value; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - - g_object_get (widget, - "min-position", &minimum_value, - "max-position", &maximum_value, - NULL); - - return atk_range_new (minimum_value, maximum_value, NULL); -} - -static void -gtk_paned_accessible_set_value (AtkValue *obj, - const double value) -{ - GtkWidget *widget; - GtkPaned *paned; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - paned = GTK_PANED (widget); - - gtk_paned_set_position (paned, (int)(value + 0.5)); -} - -static void -atk_value_interface_init (AtkValueIface *iface) -{ - iface->get_current_value = gtk_paned_accessible_get_current_value; - iface->get_maximum_value = gtk_paned_accessible_get_maximum_value; - iface->get_minimum_value = gtk_paned_accessible_get_minimum_value; - iface->set_current_value = gtk_paned_accessible_set_current_value; - - iface->get_value_and_text = gtk_paned_accessible_get_value_and_text; - iface->get_range = gtk_paned_accessible_get_range; - iface->set_value = gtk_paned_accessible_set_value; -} diff --git a/gtk/a11y/gtkpanedaccessible.h b/gtk/a11y/gtkpanedaccessible.h deleted file mode 100644 index a551b42e72..0000000000 --- a/gtk/a11y/gtkpanedaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_PANED_ACCESSIBLE_H__ -#define __GTK_PANED_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_PANED_ACCESSIBLE (gtk_paned_accessible_get_type ()) -#define GTK_PANED_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessible)) -#define GTK_PANED_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessibleClass)) -#define GTK_IS_PANED_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PANED_ACCESSIBLE)) -#define GTK_IS_PANED_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PANED_ACCESSIBLE)) -#define GTK_PANED_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessibleClass)) - -typedef struct _GtkPanedAccessible GtkPanedAccessible; -typedef struct _GtkPanedAccessibleClass GtkPanedAccessibleClass; -typedef struct _GtkPanedAccessiblePrivate GtkPanedAccessiblePrivate; - -struct _GtkPanedAccessible -{ - GtkWidgetAccessible parent; - - GtkPanedAccessiblePrivate *priv; -}; - -struct _GtkPanedAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_paned_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_PANED_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkpasswordentryaccessible.c b/gtk/a11y/gtkpasswordentryaccessible.c deleted file mode 100644 index 350f681926..0000000000 --- a/gtk/a11y/gtkpasswordentryaccessible.c +++ /dev/null @@ -1,654 +0,0 @@ -/* gtkpasswordentryaccessible.c: A GtkWidgetAccessible for GtkPasswordEntry - * - * 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/>. - */ - -#include "config.h" - -#include "gtkpasswordentryaccessibleprivate.h" - -#include "gtkeditable.h" -#include "gtkimage.h" -#include "gtkintl.h" -#include "gtklabel.h" -#include "gtkpango.h" -#include "gtkpasswordentryprivate.h" -#include "gtkstylecontextprivate.h" -#include "gtktextprivate.h" - -struct _GtkPasswordEntryAccessible -{ - GtkWidgetAccessible parent_instance; - - int cursor_position; - int selection_bound; -}; - -static void atk_editable_text_interface_init (AtkEditableTextIface *iface); -static void atk_text_interface_init (AtkTextIface *iface); -static void atk_action_interface_init (AtkActionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkPasswordEntryAccessible, gtk_password_entry_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - -static inline GtkText * -get_text_widget (GtkAccessible *accessible) -{ - GtkWidget *widget = gtk_accessible_get_widget (accessible); - - if (widget == NULL) - return NULL; - - GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget); - - return gtk_password_entry_get_text_widget (entry); -} - -static gunichar -gtk_password_entry_accessible_get_character_at_offset (AtkText *atk_text, - int offset) -{ - GtkText *text; - char *contents, *index; - gunichar result; - - result = '\0'; - - text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - if (text == NULL) - return 0; - - if (!gtk_text_get_visibility (text)) - return result; - - contents = gtk_text_get_display_text (text, 0, -1); - if (offset < g_utf8_strlen (contents, -1)) - { - index = g_utf8_offset_to_pointer (contents, offset); - result = g_utf8_get_char (index); - g_free (contents); - } - - return result; -} - -static int -gtk_password_entry_accessible_get_caret_offset (AtkText *atk_text) -{ - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - - if (widget == NULL) - return -1; - - int cursor_position = 0; - gboolean result = gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), NULL, &cursor_position); - if (!result) - return -1; - - return cursor_position; -} - -static gboolean -gtk_password_entry_accessible_set_caret_offset (AtkText *atk_text, - int offset) -{ - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return FALSE; - - gtk_editable_set_position (GTK_EDITABLE (widget), offset); - - return TRUE; -} - -static int -gtk_password_entry_accessible_get_character_count (AtkText *atk_text) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - if (text == NULL) - return 0; - - char *display_text = gtk_text_get_display_text (text, 0, -1); - - int char_count = 0; - if (display_text) - { - char_count = g_utf8_strlen (display_text, -1); - g_free (display_text); - } - - return char_count; -} - -static int -gtk_password_entry_accessible_get_offset_at_point (AtkText *atk_text, - int x, - int y, - AtkCoordType coords) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - int index, x_layout, y_layout; - int x_local, y_local; - glong offset; - - if (text == NULL) - return 1; - - gtk_text_get_layout_offsets (text, &x_layout, &y_layout); - - x_local = x - x_layout; - y_local = y - y_layout; - - if (!pango_layout_xy_to_index (gtk_text_get_layout (text), - x_local * PANGO_SCALE, - y_local * PANGO_SCALE, - &index, NULL)) - { - if (x_local < 0 || y_local < 0) - index = 0; - else - index = -1; - } - - offset = -1; - if (index != -1) - { - char *entry_text = gtk_text_get_display_text (text, 0, -1); - offset = g_utf8_pointer_to_offset (entry_text, entry_text + index); - g_free (entry_text); - } - - return offset; -} - -static void -atk_text_interface_init (AtkTextIface *iface) -{ - iface->get_character_at_offset = gtk_password_entry_accessible_get_character_at_offset; - iface->get_caret_offset = gtk_password_entry_accessible_get_caret_offset; - iface->set_caret_offset = gtk_password_entry_accessible_set_caret_offset; - iface->get_character_count = gtk_password_entry_accessible_get_character_count; - iface->get_offset_at_point = gtk_password_entry_accessible_get_offset_at_point; -} - -static void -gtk_password_entry_accessible_set_text_contents (AtkEditableText *text, - const char *string) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - if (!gtk_editable_get_editable (GTK_EDITABLE (widget))) - return; - - gtk_editable_set_text (GTK_EDITABLE (widget), string); -} - -static void -gtk_password_entry_accessible_insert_text (AtkEditableText *text, - const char *string, - int length, - int *position) -{ - GtkWidget *widget; - GtkEditable *editable; - int pos = 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - if (position != NULL) - pos = *position; - - gtk_editable_insert_text (editable, string, length, &pos); - gtk_editable_set_position (editable, pos); - - if (position != NULL) - *position = pos; -} - -static void -gtk_password_entry_accessible_delete_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - gtk_editable_delete_text (editable, start_pos, end_pos); -} - -typedef struct -{ - GtkEditable *entry; - int position; -} PasteData; - -static void -paste_received_cb (GObject *clipboard, - GAsyncResult *result, - gpointer data) -{ - PasteData *paste = data; - char *text; - - text = gdk_clipboard_read_text_finish (GDK_CLIPBOARD (clipboard), result, NULL); - if (text != NULL) - gtk_editable_insert_text (paste->entry, - text, -1, - &(paste->position)); - - g_object_unref (paste->entry); - g_free (paste); - g_free (text); -} - -static void -gtk_password_entry_accessible_paste_text (AtkEditableText *text, - int position) -{ - GtkWidget *widget; - GtkEditable *editable; - PasteData *paste; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - paste = g_new0 (PasteData, 1); - paste->entry = GTK_EDITABLE (widget); - paste->position = position; - - g_object_ref (paste->entry); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_read_text_async (clipboard, NULL, paste_received_cb, paste); -} - -static void -atk_editable_text_interface_init (AtkEditableTextIface *iface) -{ - iface->set_text_contents = gtk_password_entry_accessible_set_text_contents; - iface->insert_text = gtk_password_entry_accessible_insert_text; - iface->copy_text = NULL; - iface->cut_text = NULL; - iface->delete_text = gtk_password_entry_accessible_delete_text; - iface->paste_text = gtk_password_entry_accessible_paste_text; - iface->set_run_attributes = NULL; -} - -static gboolean -gtk_password_entry_accessible_do_action (AtkAction *action, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - if (i == 0) - { - gtk_widget_activate (widget); - return TRUE; - } - - if (i == 1) - { - GtkText *text = get_text_widget (GTK_ACCESSIBLE (action)); - - gboolean visibility = gtk_text_get_visibility (text); - gtk_text_set_visibility (text, !visibility); - - return TRUE; - } - - return FALSE; -} - -static int -gtk_password_entry_accessible_get_n_actions (AtkAction *action) -{ - GtkAccessible *accessible = GTK_ACCESSIBLE (action); - - GtkWidget *widget = gtk_accessible_get_widget (accessible); - if (widget == NULL) - return 0; - - int n_actions = 1; - if (gtk_password_entry_get_show_peek_icon (GTK_PASSWORD_ENTRY (widget))) - n_actions += 1; - - return n_actions; -} - -static const char * -gtk_password_entry_accessible_get_keybinding (AtkAction *action, - int i) -{ - GtkWidget *widget; - GtkWidget *label; - AtkRelationSet *set; - AtkRelation *relation; - GPtrArray *target; - gpointer target_object; - guint key_val; - - if (i != 0) - return NULL; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return NULL; - - set = atk_object_ref_relation_set (ATK_OBJECT (action)); - if (!set) - return NULL; - - label = NULL; - relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY); - if (relation) - { - target = atk_relation_get_target (relation); - - target_object = g_ptr_array_index (target, 0); - label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object)); - } - - g_object_unref (set); - - if (GTK_IS_LABEL (label)) - { - key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); - if (key_val != GDK_KEY_VoidSymbol) - return gtk_accelerator_name (key_val, GDK_ALT_MASK); - } - - return NULL; -} - -static const char * -gtk_password_entry_accessible_action_get_name (AtkAction *action, - int i) -{ - switch (i) - { - case 0: - return "activate"; - - case 1: - return "peek"; - - default: - break; - } - - return NULL; -} - -static const char * -gtk_password_entry_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Activate"); - if (i == 1) - return C_("Action name", "Peek"); - - return NULL; -} - -static const char * -gtk_password_entry_accessible_action_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Activates the entry"); - - if (i == 1) - return C_("Action description", "Reveals the contents the entry"); - - return NULL; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_password_entry_accessible_do_action; - iface->get_n_actions = gtk_password_entry_accessible_get_n_actions; - iface->get_keybinding = gtk_password_entry_accessible_get_keybinding; - iface->get_name = gtk_password_entry_accessible_action_get_name; - iface->get_localized_name = gtk_password_entry_accessible_action_get_localized_name; - iface->get_description = gtk_password_entry_accessible_action_get_description; -} - -static AtkAttributeSet * -gtk_password_entry_accessible_get_attributes (AtkObject *accessible) -{ - GtkWidget *widget; - AtkAttributeSet *attributes; - AtkAttribute *placeholder_text; - char *text = NULL; - - attributes = ATK_OBJECT_CLASS (gtk_password_entry_accessible_parent_class)->get_attributes (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return attributes; - - g_object_get (widget, "placeholder-text", &text, NULL); - if (text == NULL) - return attributes; - - placeholder_text = g_malloc (sizeof (AtkAttribute)); - placeholder_text->name = g_strdup ("placeholder-text"); - placeholder_text->value = text; - - attributes = g_slist_append (attributes, placeholder_text); - - return attributes; -} - -static gboolean -check_for_selection_change (GtkPasswordEntryAccessible *self, - GtkEditable *editable) -{ - gboolean ret_val = FALSE; - int start, end; - - if (gtk_editable_get_selection_bounds (editable, &start, &end)) - { - if (end != self->cursor_position || - start != self->selection_bound) - /* - * This check is here as this function can be called - * for notification of selection_bound and current_pos. - * The values of current_pos and selection_bound may be the same - * for both notifications and we only want to generate one - * text_selection_changed signal. - */ - ret_val = TRUE; - } - else - { - /* We had a selection */ - ret_val = (self->cursor_position != self->selection_bound); - } - - self->cursor_position = end; - self->selection_bound = start; - - return ret_val; -} - -static void -on_cursor_position_changed (GObject *gobject, - GParamSpec *pspec, - gpointer data) -{ - GtkPasswordEntryAccessible *self = data; - GtkEditable *editable = GTK_EDITABLE (gobject); - - if (check_for_selection_change (self, editable)) - g_signal_emit_by_name (self, "text-selection-changed"); - - // The entry cursor position has moved so generate the signal - g_signal_emit_by_name (self, "text-caret-moved", - gtk_editable_get_position (editable)); -} - -static void -on_selection_bound_changed (GObject *gobject, - GParamSpec *pspec, - gpointer data) -{ - GtkPasswordEntryAccessible *self = data; - GtkEditable *editable = GTK_EDITABLE (gobject); - - if (check_for_selection_change (self, editable)) - g_signal_emit_by_name (self, "text-selection-changed"); -} - -static void -insert_text_cb (GtkEditable *editable, - char *new_text, - int new_text_length, - int *position, - GtkPasswordEntryAccessible *self) -{ - int length; - - if (new_text_length == 0) - return; - - length = g_utf8_strlen (new_text, new_text_length); - - g_signal_emit_by_name (self, - "text-changed::insert", - *position - length, - length); -} - -static void -delete_text_cb (GtkEditable *editable, - int start, - int end, - GtkPasswordEntryAccessible *self) -{ - GtkText *text; - - text = get_text_widget (GTK_ACCESSIBLE (self)); - if (text == NULL) - return; - - if (end < 0) - { - char *contents; - - contents = gtk_text_get_display_text (text, 0, -1); - end = g_utf8_strlen (contents, -1); - - g_free (contents); - } - - if (end == start) - return; - - g_signal_emit_by_name (self, - "text-changed::delete", - start, - end - start); -} - -static void -gtk_password_entry_accessible_initialize (AtkObject *atk_object, - gpointer data) -{ - GtkPasswordEntryAccessible *self = GTK_PASSWORD_ENTRY_ACCESSIBLE (atk_object); - GtkEditable *editable = data; - GtkWidget *widget = data; - int start_pos, end_pos; - - gtk_editable_get_selection_bounds (editable, &start_pos, &end_pos); - self->cursor_position = end_pos; - self->selection_bound = start_pos; - - /* Set up signal callbacks */ - g_signal_connect_after (widget, "insert-text", G_CALLBACK (insert_text_cb), self); - g_signal_connect (widget, "delete-text", G_CALLBACK (delete_text_cb), self); - g_signal_connect (widget, "notify::cursor-position", - G_CALLBACK (on_cursor_position_changed), self); - g_signal_connect (widget, "notify::selection-bound", - G_CALLBACK (on_selection_bound_changed), self); -} - -static void -gtk_password_entry_accessible_class_init (GtkPasswordEntryAccessibleClass *klass) -{ - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - - atk_object_class->initialize = gtk_password_entry_accessible_initialize; - atk_object_class->get_attributes = gtk_password_entry_accessible_get_attributes; -} - -static void -gtk_password_entry_accessible_init (GtkPasswordEntryAccessible *self) -{ - AtkObject *atk_obj = ATK_OBJECT (self); - - atk_obj->role = ATK_ROLE_PASSWORD_TEXT; - atk_object_set_name (atk_obj, _("Password")); -} - -void -gtk_password_entry_accessible_update_visibility (GtkPasswordEntryAccessible *self) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (self)); - - if (text == NULL) - return; - - gboolean visibility = gtk_text_get_visibility (text); - AtkRole role = visibility ? ATK_ROLE_TEXT : ATK_ROLE_PASSWORD_TEXT; - atk_object_set_role (ATK_OBJECT (self), role); -} diff --git a/gtk/a11y/gtkpasswordentryaccessible.h b/gtk/a11y/gtkpasswordentryaccessible.h deleted file mode 100644 index d1008426a8..0000000000 --- a/gtk/a11y/gtkpasswordentryaccessible.h +++ /dev/null @@ -1,48 +0,0 @@ -/* gtkpasswordentryaccessible.h: A GtkWidgetAccessible for GtkPasswordEntry - * - * 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/>. - */ - -#pragma once - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkentryaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_PASSWORD_ENTRY_ACCESSIBLE (gtk_password_entry_accessible_get_type()) -#define GTK_PASSWORD_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PASSWORD_ENTRY_ACCESSIBLE, GtkPasswordEntryAccessible)) -#define GTK_IS_PASSWORD_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PASSWORD_ENTRY_ACCESSIBLE)) - -typedef struct _GtkPasswordEntryAccessible GtkPasswordEntryAccessible; -typedef struct _GtkPasswordEntryAccessibleClass GtkPasswordEntryAccessibleClass; - -struct _GtkPasswordEntryAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_password_entry_accessible_get_type (void) G_GNUC_CONST; - -G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkPasswordEntryAccessible, g_object_unref) - -G_END_DECLS diff --git a/gtk/a11y/gtkpasswordentryaccessibleprivate.h b/gtk/a11y/gtkpasswordentryaccessibleprivate.h deleted file mode 100644 index 5ef1153814..0000000000 --- a/gtk/a11y/gtkpasswordentryaccessibleprivate.h +++ /dev/null @@ -1,29 +0,0 @@ -/* gtkpasswordentryaccessibleprivate.h: Private API for GtkPasswordEntryAccessible - * - * 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/>. - */ - -#pragma once - -#include "gtkpasswordentryaccessible.h" - -G_BEGIN_DECLS - -void gtk_password_entry_accessible_update_visibility (GtkPasswordEntryAccessible *self); - -G_END_DECLS diff --git a/gtk/a11y/gtkpictureaccessible.c b/gtk/a11y/gtkpictureaccessible.c deleted file mode 100644 index 7e4b10b3f0..0000000000 --- a/gtk/a11y/gtkpictureaccessible.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright © 2018 Benjamin Otte - * - * 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/>. - * - * Authors: Benjamin Otte <otte@gnome.org> - */ - -#include "config.h" - -#include "gtkpictureaccessibleprivate.h" - -#include "gtkpicture.h" - -struct _GtkPictureAccessible -{ - GtkWidgetAccessible parent_instance; -}; - -struct _GtkPictureAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -static const char * -gtk_picture_accessible_get_image_description (AtkImage *image) -{ - GtkWidget* widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); - if (widget == NULL) - return NULL; - - return gtk_picture_get_alternative_text (GTK_PICTURE (widget)); -} - -static void -gtk_picture_accessible_get_image_position (AtkImage *image, - int *x, - int *y, - AtkCoordType coord_type) -{ - atk_component_get_extents (ATK_COMPONENT (image), x, y, NULL, NULL, - coord_type); -} - -static void -gtk_picture_accessible_get_image_size (AtkImage *image, - int *width, - int *height) -{ - GtkWidget* widget; - GdkPaintable *paintable; - - *width = -1; - *height = -1; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); - if (widget == NULL) - return; - - paintable = gtk_picture_get_paintable (GTK_PICTURE (widget)); - if (paintable == NULL) - return; - - *width = gdk_paintable_get_intrinsic_width (paintable); - if (*width == 0) - *width = -1; - - *height = gdk_paintable_get_intrinsic_height (paintable); - if (*height == 0) - *height = -1; -} - -static void -gtk_picture_accessible_image_init (AtkImageIface *iface) -{ - iface->get_image_description = gtk_picture_accessible_get_image_description; - iface->get_image_position = gtk_picture_accessible_get_image_position; - iface->get_image_size = gtk_picture_accessible_get_image_size; -} - -G_DEFINE_TYPE_WITH_CODE (GtkPictureAccessible, gtk_picture_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, gtk_picture_accessible_image_init)) - -static void -gtk_picture_accessible_initialize (AtkObject *accessible, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_picture_accessible_parent_class)->initialize (accessible, data); - - accessible->role = ATK_ROLE_IMAGE; -} - -static const char * -gtk_picture_accessible_get_name (AtkObject *accessible) -{ - GtkWidget* widget; - const char *name; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - name = ATK_OBJECT_CLASS (gtk_picture_accessible_parent_class)->get_name (accessible); - if (name) - return name; - - return gtk_picture_get_alternative_text (GTK_PICTURE (widget)); -} - -static void -gtk_picture_accessible_class_init (GtkPictureAccessibleClass *klass) -{ - AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass); - - atkobject_class->initialize = gtk_picture_accessible_initialize; - atkobject_class->get_name = gtk_picture_accessible_get_name; -} - -static void -gtk_picture_accessible_init (GtkPictureAccessible *image) -{ -} - diff --git a/gtk/a11y/gtkpictureaccessibleprivate.h b/gtk/a11y/gtkpictureaccessibleprivate.h deleted file mode 100644 index f079a350c7..0000000000 --- a/gtk/a11y/gtkpictureaccessibleprivate.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright © 2018 Benjamin Otte - * - * 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/>. - * - * Authors: Benjamin Otte <otte@gnome.org> - */ - -#ifndef __GTK_PICTURE_ACCESSIBLE_PRIVATE_H__ -#define __GTK_PICTURE_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_PICTURE_ACCESSIBLE (gtk_picture_accessible_get_type ()) - -GDK_AVAILABLE_IN_ALL -G_DECLARE_FINAL_TYPE (GtkPictureAccessible, gtk_picture_accessible, GTK, PICTURE_ACCESSIBLE, GtkWidgetAccessible) - -G_END_DECLS - -#endif /* __GTK_PICTURE_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtkpopoveraccessible.c b/gtk/a11y/gtkpopoveraccessible.c deleted file mode 100644 index 6d222a5f5a..0000000000 --- a/gtk/a11y/gtkpopoveraccessible.c +++ /dev/null @@ -1,93 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright © 2014 Red Hat Inc. - * - * 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 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/>. - * - * Author: Carlos Garnacho <carlosg@gnome.org> - */ - -#include "config.h" - -#include <glib/gi18n-lib.h> -#include <gtk/gtk.h> -#include "gtkpopoveraccessible.h" - -typedef struct _GtkPopoverAccessiblePrivate GtkPopoverAccessiblePrivate; - -G_DEFINE_TYPE (GtkPopoverAccessible, gtk_popover_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static void -popover_update_modality (AtkObject *object, - GtkPopover *popover) -{ - atk_object_notify_state_change (object, ATK_STATE_MODAL, - gtk_popover_get_autohide (popover)); -} - -static void -popover_notify_cb (GtkPopover *popover, - GParamSpec *pspec, - AtkObject *object) -{ - AtkObject *popover_accessible; - - popover_accessible = gtk_widget_get_accessible (GTK_WIDGET (popover)); - - if (strcmp (g_param_spec_get_name (pspec), "modal") == 0) - popover_update_modality (popover_accessible, popover); -} - -static void -gtk_popover_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkPopover *popover = GTK_POPOVER (data); - - ATK_OBJECT_CLASS (gtk_popover_accessible_parent_class)->initialize (obj, data); - - g_signal_connect (popover, "notify", - G_CALLBACK (popover_notify_cb), obj); - popover_update_modality (obj, popover); - - obj->role = ATK_ROLE_PANEL; -} - -static AtkStateSet * -gtk_popover_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - state_set = ATK_OBJECT_CLASS (gtk_popover_accessible_parent_class)->ref_state_set (obj); - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - - if (gtk_popover_get_autohide (GTK_POPOVER (widget))) - atk_state_set_add_state (state_set, ATK_STATE_MODAL); - - return state_set; -} - -static void -gtk_popover_accessible_class_init (GtkPopoverAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->initialize = gtk_popover_accessible_initialize; - class->ref_state_set = gtk_popover_accessible_ref_state_set; -} - -static void -gtk_popover_accessible_init (GtkPopoverAccessible *popover) -{ -} diff --git a/gtk/a11y/gtkpopoveraccessible.h b/gtk/a11y/gtkpopoveraccessible.h deleted file mode 100644 index fc6d83954b..0000000000 --- a/gtk/a11y/gtkpopoveraccessible.h +++ /dev/null @@ -1,56 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright © 2014 Red Hat Inc. - * - * 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 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/>. - * - * Author: Carlos Garnacho <carlosg@gnome.org> - */ - -#ifndef __GTK_POPOVER_ACCESSIBLE_H__ -#define __GTK_POPOVER_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_POPOVER_ACCESSIBLE (gtk_popover_accessible_get_type ()) -#define GTK_POPOVER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_POPOVER_ACCESSIBLE, GtkPopoverAccessible)) -#define GTK_POPOVER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_POPOVER_ACCESSIBLE, GtkPopoverAccessibleClass)) -#define GTK_IS_POPOVER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_POPOVER_ACCESSIBLE)) -#define GTK_IS_POPOVER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_POPOVER_ACCESSIBLE)) -#define GTK_POPOVER_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_POPOVER_ACCESSIBLE, GtkPopoverAccessibleClass)) - -typedef struct _GtkPopoverAccessible GtkPopoverAccessible; -typedef struct _GtkPopoverAccessibleClass GtkPopoverAccessibleClass; - -struct _GtkPopoverAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkPopoverAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_popover_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_POPOVER_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkprogressbaraccessible.c b/gtk/a11y/gtkprogressbaraccessible.c deleted file mode 100644 index cf91831305..0000000000 --- a/gtk/a11y/gtkprogressbaraccessible.c +++ /dev/null @@ -1,107 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> - -#include <gtk/gtk.h> - -#include "gtkprogressbaraccessibleprivate.h" - -static void atk_value_interface_init (AtkValueIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkProgressBarAccessible, gtk_progress_bar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) - -void -gtk_progress_bar_accessible_update_value (GtkProgressBarAccessible *self) -{ - g_object_notify (G_OBJECT (self), "accessible-value"); -} - -static void -gtk_progress_bar_accessible_class_init (GtkProgressBarAccessibleClass *klass) -{ -} - -static void -gtk_progress_bar_accessible_init (GtkProgressBarAccessible *self) -{ - ATK_OBJECT (self)->role = ATK_ROLE_PROGRESS_BAR; -} - -static void -gtk_progress_bar_accessible_get_current_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget))); -} - -static void -gtk_progress_bar_accessible_get_maximum_value (AtkValue *obj, - GValue *value) -{ - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, 1.0); -} - -static void -gtk_progress_bar_accessible_get_minimum_value (AtkValue *obj, - GValue *value) -{ - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, 0.0); -} - -static void -gtk_progress_bar_accessible_get_value_and_text (AtkValue *obj, - double *value, - char **text) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - - *value = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget)); - *text = NULL; -} - -static AtkRange * -gtk_progress_bar_accessible_get_range (AtkValue *obj) -{ - return atk_range_new (0.0, 1.0, NULL); -} - -static void -atk_value_interface_init (AtkValueIface *iface) -{ - iface->get_current_value = gtk_progress_bar_accessible_get_current_value; - iface->get_maximum_value = gtk_progress_bar_accessible_get_maximum_value; - iface->get_minimum_value = gtk_progress_bar_accessible_get_minimum_value; - - iface->get_value_and_text = gtk_progress_bar_accessible_get_value_and_text; - iface->get_range = gtk_progress_bar_accessible_get_range; -} diff --git a/gtk/a11y/gtkprogressbaraccessible.h b/gtk/a11y/gtkprogressbaraccessible.h deleted file mode 100644 index 2c0a218049..0000000000 --- a/gtk/a11y/gtkprogressbaraccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_PROGRESS_BAR_ACCESSIBLE_H__ -#define __GTK_PROGRESS_BAR_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_PROGRESS_BAR_ACCESSIBLE (gtk_progress_bar_accessible_get_type ()) -#define GTK_PROGRESS_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessible)) -#define GTK_PROGRESS_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessibleClass)) -#define GTK_IS_PROGRESS_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE)) -#define GTK_IS_PROGRESS_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE)) -#define GTK_PROGRESS_BAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessibleClass)) - -typedef struct _GtkProgressBarAccessible GtkProgressBarAccessible; -typedef struct _GtkProgressBarAccessibleClass GtkProgressBarAccessibleClass; -typedef struct _GtkProgressBarAccessiblePrivate GtkProgressBarAccessiblePrivate; - -struct _GtkProgressBarAccessible -{ - GtkWidgetAccessible parent; - - GtkProgressBarAccessiblePrivate *priv; -}; - -struct _GtkProgressBarAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_progress_bar_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_PROGRESS_BAR_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkprogressbaraccessibleprivate.h b/gtk/a11y/gtkprogressbaraccessibleprivate.h deleted file mode 100644 index 120d21c5b2..0000000000 --- a/gtk/a11y/gtkprogressbaraccessibleprivate.h +++ /dev/null @@ -1,29 +0,0 @@ -/* gtkprogressbaraccessibleprivate.h: Private GtkProgressBarAccessible API - * - * 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/>. - */ - -#pragma once - -#include "gtkprogressbaraccessible.h" - -G_BEGIN_DECLS - -void gtk_progress_bar_accessible_update_value (GtkProgressBarAccessible *self); - -G_END_DECLS diff --git a/gtk/a11y/gtkradiobuttonaccessible.c b/gtk/a11y/gtkradiobuttonaccessible.c deleted file mode 100644 index 4670d14f7a..0000000000 --- a/gtk/a11y/gtkradiobuttonaccessible.c +++ /dev/null @@ -1,118 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtkradiobuttonaccessible.h" - -struct _GtkRadioButtonAccessiblePrivate -{ - GSList *old_group; -}; - - -G_DEFINE_TYPE_WITH_PRIVATE (GtkRadioButtonAccessible, gtk_radio_button_accessible, GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE) - -static void -gtk_radio_button_accessible_initialize (AtkObject *accessible, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_radio_button_accessible_parent_class)->initialize (accessible, data); - - accessible->role = ATK_ROLE_RADIO_BUTTON; -} - -static AtkRelationSet * -gtk_radio_button_accessible_ref_relation_set (AtkObject *obj) -{ - GtkWidget *widget; - AtkRelationSet *relation_set; - GSList *list; - GtkRadioButtonAccessible *radio_button; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - radio_button = GTK_RADIO_BUTTON_ACCESSIBLE (obj); - - relation_set = ATK_OBJECT_CLASS (gtk_radio_button_accessible_parent_class)->ref_relation_set (obj); - - /* If the radio button'group has changed remove the relation */ - list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); - - if (radio_button->priv->old_group != list) - { - AtkRelation *relation; - - relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_MEMBER_OF); - atk_relation_set_remove (relation_set, relation); - } - - if (!atk_relation_set_contains (relation_set, ATK_RELATION_MEMBER_OF)) - { - /* - * Get the members of the button group - */ - radio_button->priv->old_group = list; - if (list) - { - AtkObject **accessible_array; - guint list_length; - AtkRelation* relation; - int i = 0; - - list_length = g_slist_length (list); - accessible_array = g_new (AtkObject *, list_length); - while (list != NULL) - { - GtkWidget* list_item = list->data; - - accessible_array[i++] = gtk_widget_get_accessible (list_item); - - list = list->next; - } - relation = atk_relation_new (accessible_array, list_length, - ATK_RELATION_MEMBER_OF); - g_free (accessible_array); - - atk_relation_set_add (relation_set, relation); - /* - * Unref the relation so that it is not leaked. - */ - g_object_unref (relation); - } - } - - return relation_set; -} - -static void -gtk_radio_button_accessible_class_init (GtkRadioButtonAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->initialize = gtk_radio_button_accessible_initialize; - class->ref_relation_set = gtk_radio_button_accessible_ref_relation_set; -} - -static void -gtk_radio_button_accessible_init (GtkRadioButtonAccessible *radio_button) -{ - radio_button->priv = gtk_radio_button_accessible_get_instance_private (radio_button); -} diff --git a/gtk/a11y/gtkradiobuttonaccessible.h b/gtk/a11y/gtkradiobuttonaccessible.h deleted file mode 100644 index 7bb35c19e6..0000000000 --- a/gtk/a11y/gtkradiobuttonaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_RADIO_BUTTON_ACCESSIBLE_H__ -#define __GTK_RADIO_BUTTON_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtktogglebuttonaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_RADIO_BUTTON_ACCESSIBLE (gtk_radio_button_accessible_get_type ()) -#define GTK_RADIO_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE, GtkRadioButtonAccessible)) -#define GTK_RADIO_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE, GtkRadioButtonAccessibleClass)) -#define GTK_IS_RADIO_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE)) -#define GTK_IS_RADIO_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE)) -#define GTK_RADIO_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE, GtkRadioButtonAccessibleClass)) - -typedef struct _GtkRadioButtonAccessible GtkRadioButtonAccessible; -typedef struct _GtkRadioButtonAccessibleClass GtkRadioButtonAccessibleClass; -typedef struct _GtkRadioButtonAccessiblePrivate GtkRadioButtonAccessiblePrivate; - -struct _GtkRadioButtonAccessible -{ - GtkToggleButtonAccessible parent; - - GtkRadioButtonAccessiblePrivate *priv; -}; - -struct _GtkRadioButtonAccessibleClass -{ - GtkToggleButtonAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_radio_button_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_RADIO_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkrangeaccessible.c b/gtk/a11y/gtkrangeaccessible.c deleted file mode 100644 index a004979143..0000000000 --- a/gtk/a11y/gtkrangeaccessible.c +++ /dev/null @@ -1,305 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtkrangeaccessible.h" - -typedef struct -{ - GtkAdjustment *adjustment; - - gulong value_changed_id; -} GtkRangeAccessiblePrivate; - -static void atk_value_interface_init (AtkValueIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkRangeAccessible, gtk_range_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkRangeAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) - -static void -gtk_range_accessible_value_changed (GtkAdjustment *adjustment, - gpointer data) -{ - g_object_notify (G_OBJECT (data), "accessible-value"); -} - -static void -gtk_range_accessible_widget_set (GtkAccessible *accessible) -{ - GtkRangeAccessible *self = GTK_RANGE_ACCESSIBLE (accessible); - GtkRangeAccessiblePrivate *priv = gtk_range_accessible_get_instance_private (self); - GtkWidget *range; - GtkAdjustment *adj; - - range = gtk_accessible_get_widget (accessible); - adj = gtk_range_get_adjustment (GTK_RANGE (range)); - if (adj != NULL) - { - priv->adjustment = g_object_ref (adj); - priv->value_changed_id = - g_signal_connect (priv->adjustment, "value-changed", - G_CALLBACK (gtk_range_accessible_value_changed), - self); - } -} - -static void -gtk_range_accessible_widget_unset (GtkAccessible *accessible) -{ - GtkRangeAccessible *self = GTK_RANGE_ACCESSIBLE (accessible); - GtkRangeAccessiblePrivate *priv = gtk_range_accessible_get_instance_private (self); - - if (priv->adjustment != NULL && - priv->value_changed_id != 0) - { - g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id); - priv->value_changed_id = 0; - } - - g_clear_object (&priv->adjustment); -} - -void -gtk_range_accessible_update_adjustment (GtkRangeAccessible *self) -{ - gtk_range_accessible_widget_unset (GTK_ACCESSIBLE (self)); - gtk_range_accessible_widget_set (GTK_ACCESSIBLE (self)); -} - -static void -gtk_range_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_range_accessible_parent_class)->initialize (obj, data); - obj->role = ATK_ROLE_SLIDER; -} - -static void -gtk_range_accessible_dispose (GObject *gobject) -{ - GtkRangeAccessible *self = GTK_RANGE_ACCESSIBLE (gobject); - GtkRangeAccessiblePrivate *priv = gtk_range_accessible_get_instance_private (self); - - if (priv->adjustment != NULL && priv->value_changed_id != 0) - { - g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id); - priv->value_changed_id = 0; - } - - g_clear_object (&priv->adjustment); - - G_OBJECT_CLASS (gtk_range_accessible_parent_class)->dispose (gobject); -} - -static void -gtk_range_accessible_class_init (GtkRangeAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass); - GtkAccessibleClass *accessible_class = (GtkAccessibleClass*)klass; - - gobject_class->dispose = gtk_range_accessible_dispose; - - atkobject_class->initialize = gtk_range_accessible_initialize; - - accessible_class->widget_set = gtk_range_accessible_widget_set; - accessible_class->widget_unset = gtk_range_accessible_widget_unset; -} - -static void -gtk_range_accessible_init (GtkRangeAccessible *range) -{ -} - -static void -gtk_range_accessible_get_current_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_value (adjustment)); -} - -static void -gtk_range_accessible_get_maximum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - double max; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return; - - max = gtk_adjustment_get_upper (adjustment) - - gtk_adjustment_get_page_size (adjustment); - - if (gtk_range_get_restrict_to_fill_level (GTK_RANGE (widget))) - max = MIN (max, gtk_range_get_fill_level (GTK_RANGE (widget))); - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, max); -} - -static void -gtk_range_accessible_get_minimum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_lower (adjustment)); -} - -static void -gtk_range_accessible_get_minimum_increment (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_minimum_increment (adjustment)); -} - -static gboolean -gtk_range_accessible_set_current_value (AtkValue *obj, - const GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return FALSE; - - gtk_adjustment_set_value (adjustment, g_value_get_double (value)); - - return TRUE; -} - -static void -gtk_range_accessible_get_value_and_text (AtkValue *obj, - double *value, - char **text) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return; - - *value = gtk_adjustment_get_value (adjustment); - *text = NULL; -} - -static AtkRange * -gtk_range_accessible_get_range (AtkValue *obj) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - double min, max; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return NULL; - - min = gtk_adjustment_get_lower (adjustment); - max = gtk_adjustment_get_upper (adjustment) - - gtk_adjustment_get_page_size (adjustment); - - if (gtk_range_get_restrict_to_fill_level (GTK_RANGE (widget))) - max = MIN (max, gtk_range_get_fill_level (GTK_RANGE (widget))); - - return atk_range_new (min, max, NULL); -} - -static void -gtk_range_accessible_set_value (AtkValue *obj, - const double value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return; - - gtk_adjustment_set_value (adjustment, value); -} - -static double -gtk_range_accessible_get_increment (AtkValue *obj) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - if (adjustment == NULL) - return 0; - - return gtk_adjustment_get_minimum_increment (adjustment); -} - -static void -atk_value_interface_init (AtkValueIface *iface) -{ - iface->get_current_value = gtk_range_accessible_get_current_value; - iface->get_maximum_value = gtk_range_accessible_get_maximum_value; - iface->get_minimum_value = gtk_range_accessible_get_minimum_value; - iface->get_minimum_increment = gtk_range_accessible_get_minimum_increment; - iface->set_current_value = gtk_range_accessible_set_current_value; - - iface->get_value_and_text = gtk_range_accessible_get_value_and_text; - iface->get_range = gtk_range_accessible_get_range; - iface->set_value = gtk_range_accessible_set_value; - iface->get_increment = gtk_range_accessible_get_increment; -} diff --git a/gtk/a11y/gtkrangeaccessible.h b/gtk/a11y/gtkrangeaccessible.h deleted file mode 100644 index 8779fb8eae..0000000000 --- a/gtk/a11y/gtkrangeaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_RANGE_ACCESSIBLE_H__ -#define __GTK_RANGE_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_RANGE_ACCESSIBLE (gtk_range_accessible_get_type ()) -#define GTK_RANGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessible)) -#define GTK_RANGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessibleClass)) -#define GTK_IS_RANGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RANGE_ACCESSIBLE)) -#define GTK_IS_RANGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE_ACCESSIBLE)) -#define GTK_RANGE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessibleClass)) - -typedef struct _GtkRangeAccessible GtkRangeAccessible; -typedef struct _GtkRangeAccessibleClass GtkRangeAccessibleClass; - -struct _GtkRangeAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkRangeAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_range_accessible_get_type (void); - -/*< private >*/ -void gtk_range_accessible_update_adjustment (GtkRangeAccessible *self); - -G_END_DECLS - -#endif /* __GTK_RANGE_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkrenderercellaccessible.c b/gtk/a11y/gtkrenderercellaccessible.c deleted file mode 100644 index 3306c6d8ff..0000000000 --- a/gtk/a11y/gtkrenderercellaccessible.c +++ /dev/null @@ -1,123 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtkrenderercellaccessible.h" -#include "gtkintl.h" - -struct _GtkRendererCellAccessiblePrivate -{ - GtkCellRenderer *renderer; -}; - -enum { - PROP_0, - PROP_RENDERER -}; - -G_DEFINE_TYPE_WITH_PRIVATE (GtkRendererCellAccessible, gtk_renderer_cell_accessible, GTK_TYPE_CELL_ACCESSIBLE) - -static void -gtk_renderer_cell_accessible_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GtkRendererCellAccessible *accessible = GTK_RENDERER_CELL_ACCESSIBLE (object); - - switch (prop_id) - { - case PROP_RENDERER: - accessible->priv->renderer = g_value_dup_object (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gtk_renderer_cell_accessible_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GtkRendererCellAccessible *accessible = GTK_RENDERER_CELL_ACCESSIBLE (object); - - switch (prop_id) - { - case PROP_RENDERER: - g_value_set_object (value, accessible->priv->renderer); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gtk_renderer_cell_accessible_finalize (GObject *object) -{ - GtkRendererCellAccessible *renderer_cell = GTK_RENDERER_CELL_ACCESSIBLE (object); - - if (renderer_cell->priv->renderer) - g_object_unref (renderer_cell->priv->renderer); - - G_OBJECT_CLASS (gtk_renderer_cell_accessible_parent_class)->finalize (object); -} - -static void -gtk_renderer_cell_accessible_class_init (GtkRendererCellAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->get_property = gtk_renderer_cell_accessible_get_property; - gobject_class->set_property = gtk_renderer_cell_accessible_set_property; - gobject_class->finalize = gtk_renderer_cell_accessible_finalize; - - g_object_class_install_property (gobject_class, - PROP_RENDERER, - g_param_spec_object ("renderer", - P_("Cell renderer"), - P_("The cell renderer represented by this accessible"), - GTK_TYPE_CELL_RENDERER, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); -} - -static void -gtk_renderer_cell_accessible_init (GtkRendererCellAccessible *renderer_cell) -{ - renderer_cell->priv = gtk_renderer_cell_accessible_get_instance_private (renderer_cell); -} - -AtkObject * -gtk_renderer_cell_accessible_new (GtkCellRenderer *renderer) -{ - AtkObject *object; - - g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), NULL); - - object = g_object_new (_gtk_cell_renderer_get_accessible_type (renderer), - "renderer", renderer, - NULL); - - atk_object_set_role (object, ATK_ROLE_TABLE_CELL); - - return object; -} diff --git a/gtk/a11y/gtkrenderercellaccessible.h b/gtk/a11y/gtkrenderercellaccessible.h deleted file mode 100644 index ac39d89639..0000000000 --- a/gtk/a11y/gtkrenderercellaccessible.h +++ /dev/null @@ -1,61 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_RENDERER_CELL_ACCESSIBLE_H__ -#define __GTK_RENDERER_CELL_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <atk/atk.h> -#include <gtk/a11y/gtkcellaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_RENDERER_CELL_ACCESSIBLE (gtk_renderer_cell_accessible_get_type ()) -#define GTK_RENDERER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RENDERER_CELL_ACCESSIBLE, GtkRendererCellAccessible)) -#define GTK_RENDERER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RENDERER_CELL_ACCESSIBLE, GtkRendererCellAccessibleClass)) -#define GTK_IS_RENDERER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RENDERER_CELL_ACCESSIBLE)) -#define GTK_IS_RENDERER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RENDERER_CELL_ACCESSIBLE)) -#define GTK_RENDERER_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RENDERER_CELL_ACCESSIBLE, GtkRendererCellAccessibleClass)) - -typedef struct _GtkRendererCellAccessible GtkRendererCellAccessible; -typedef struct _GtkRendererCellAccessibleClass GtkRendererCellAccessibleClass; -typedef struct _GtkRendererCellAccessiblePrivate GtkRendererCellAccessiblePrivate; - -struct _GtkRendererCellAccessible -{ - GtkCellAccessible parent; - - GtkRendererCellAccessiblePrivate *priv; -}; - -struct _GtkRendererCellAccessibleClass -{ - GtkCellAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_renderer_cell_accessible_get_type (void); - -GDK_AVAILABLE_IN_ALL -AtkObject *gtk_renderer_cell_accessible_new (GtkCellRenderer * renderer); - -G_END_DECLS - -#endif /* __GTK_RENDERER_CELL_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkscaleaccessible.c b/gtk/a11y/gtkscaleaccessible.c deleted file mode 100644 index b369b449a7..0000000000 --- a/gtk/a11y/gtkscaleaccessible.c +++ /dev/null @@ -1,53 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2004 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtkscaleaccessible.h" - -G_DEFINE_TYPE (GtkScaleAccessible, gtk_scale_accessible, GTK_TYPE_RANGE_ACCESSIBLE) - -static const char * -gtk_scale_accessible_get_description (AtkObject *object) -{ - GtkWidget *widget; - PangoLayout *layout; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); - if (widget == NULL) - return NULL; - - layout = gtk_scale_get_layout (GTK_SCALE (widget)); - if (layout) - return pango_layout_get_text (layout); - - return ATK_OBJECT_CLASS (gtk_scale_accessible_parent_class)->get_description (object); -} - -static void -gtk_scale_accessible_class_init (GtkScaleAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_description = gtk_scale_accessible_get_description; -} - -static void -gtk_scale_accessible_init (GtkScaleAccessible *scale) -{ -} diff --git a/gtk/a11y/gtkscaleaccessible.h b/gtk/a11y/gtkscaleaccessible.h deleted file mode 100644 index a141293f3a..0000000000 --- a/gtk/a11y/gtkscaleaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2004 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_SCALE_ACCESSIBLE_H__ -#define __GTK_SCALE_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkrangeaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_SCALE_ACCESSIBLE (gtk_scale_accessible_get_type ()) -#define GTK_SCALE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessible)) -#define GTK_SCALE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass)) -#define GTK_IS_SCALE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCALE_ACCESSIBLE)) -#define GTK_IS_SCALE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCALE_ACCESSIBLE)) -#define GTK_SCALE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass)) - -typedef struct _GtkScaleAccessible GtkScaleAccessible; -typedef struct _GtkScaleAccessibleClass GtkScaleAccessibleClass; -typedef struct _GtkScaleAccessiblePrivate GtkScaleAccessiblePrivate; - -struct _GtkScaleAccessible -{ - GtkRangeAccessible parent; - - GtkScaleAccessiblePrivate *priv; -}; - -struct _GtkScaleAccessibleClass -{ - GtkRangeAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_scale_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_SCALE_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkscalebuttonaccessible.c b/gtk/a11y/gtkscalebuttonaccessible.c deleted file mode 100644 index e569fc4dcd..0000000000 --- a/gtk/a11y/gtkscalebuttonaccessible.c +++ /dev/null @@ -1,376 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2008 Jan Arne Petersen - * - * 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 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/>. - */ - -#include <config.h> - -#include <glib/gi18n-lib.h> -#include <gtk/gtk.h> -#include "gtkscalebuttonaccessible.h" - -#include <string.h> - -typedef struct { - GtkAdjustment *adjustment; - gulong value_changed_id; -} GtkScaleButtonAccessiblePrivate; - -static void atk_action_interface_init (AtkActionIface *iface); -static void atk_value_interface_init (AtkValueIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkScaleButtonAccessible, gtk_scale_button_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkScaleButtonAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)); - -static void -on_value_changed (GtkAdjustment *adjustment, - gpointer data) -{ - GtkScaleButtonAccessible *self = data; - - g_object_notify (G_OBJECT (self), "accessible-value"); -} - -static void -on_adjustment_changed (GObject *gobject, - GParamSpec *pspec, - gpointer data) -{ - GtkScaleButton *scale_button = GTK_SCALE_BUTTON (gobject); - GtkScaleButtonAccessible *self = data; - GtkScaleButtonAccessiblePrivate *priv = - gtk_scale_button_accessible_get_instance_private (self); - GtkAdjustment *adjustment = - gtk_scale_button_get_adjustment (scale_button); - - if (priv->adjustment == adjustment) - return; - - if (priv->adjustment != NULL && priv->value_changed_id != 0) - { - g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id); - priv->value_changed_id = 0; - } - - g_clear_object (&priv->adjustment); - - if (adjustment != NULL) - { - priv->adjustment = g_object_ref (adjustment); - priv->value_changed_id = - g_signal_connect (priv->adjustment, "notify::value-changed", - G_CALLBACK (on_value_changed), - self); - } -} - -static void -gtk_scale_button_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkScaleButton *scale_button = data; - - ATK_OBJECT_CLASS (gtk_scale_button_accessible_parent_class)->initialize (obj, data); - - g_signal_connect (scale_button, "notify::adjustment", - G_CALLBACK (on_adjustment_changed), - obj); -} - -static void -gtk_scale_button_accessible_dispose (GObject *gobject) -{ - GtkScaleButtonAccessible *self = GTK_SCALE_BUTTON_ACCESSIBLE (gobject); - GtkScaleButtonAccessiblePrivate *priv = - gtk_scale_button_accessible_get_instance_private (self); - - if (priv->adjustment != NULL && priv->value_changed_id != 0) - { - g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id); - priv->value_changed_id = 0; - } - - g_clear_object (&priv->adjustment); - - G_OBJECT_CLASS (gtk_scale_button_accessible_parent_class)->dispose (gobject); -} - -static void -gtk_scale_button_accessible_class_init (GtkScaleButtonAccessibleClass *klass) -{ - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->dispose = gtk_scale_button_accessible_dispose; - - atk_object_class->initialize = gtk_scale_button_accessible_initialize; -} - -static void -gtk_scale_button_accessible_init (GtkScaleButtonAccessible *self) -{ - ATK_OBJECT (self)->role = ATK_ROLE_SLIDER; -} - -static gboolean -gtk_scale_button_accessible_do_action (AtkAction *action, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - switch (i) - { - case 0: - g_signal_emit_by_name (widget, "popup"); - return TRUE; - case 1: - g_signal_emit_by_name (widget, "popdown"); - return TRUE; - default: - return FALSE; - } -} - -static int -gtk_scale_button_accessible_get_n_actions (AtkAction *action) -{ - return 2; -} - -static const char * -gtk_scale_button_accessible_get_description (AtkAction *action, - int i) -{ - switch (i) - { - case 0: - return C_("Action description", "Pops up the slider"); - case 1: - return C_("Action description", "Dismisses the slider"); - default: - return NULL; - } -} - -static const char * -gtk_scale_button_accessible_action_get_name (AtkAction *action, - int i) -{ - switch (i) - { - case 0: - return "popup"; - case 1: - return "popdown"; - default: - return NULL; - } -} - -static const char * -gtk_scale_button_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - switch (i) - { - case 0: - return C_("Action name", "Popup"); - case 1: - return C_("Action name", "Dismiss"); - default: - return NULL; - } -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_scale_button_accessible_do_action; - iface->get_n_actions = gtk_scale_button_accessible_get_n_actions; - iface->get_description = gtk_scale_button_accessible_get_description; - iface->get_name = gtk_scale_button_accessible_action_get_name; - iface->get_localized_name = gtk_scale_button_accessible_action_get_localized_name; -} - -static void -gtk_scale_button_accessible_get_current_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_value (adjustment)); -} - -static void -gtk_scale_button_accessible_get_maximum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_upper (adjustment)); -} - -static void -gtk_scale_button_accessible_get_minimum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_lower (adjustment)); -} - -static void -gtk_scale_button_accessible_get_minimum_increment (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_minimum_increment (adjustment)); -} - -static gboolean -gtk_scale_button_accessible_set_current_value (AtkValue *obj, - const GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return FALSE; - - gtk_adjustment_set_value (adjustment, g_value_get_double (value)); - - return TRUE; -} - -static void -gtk_scale_button_accessible_get_value_and_text (AtkValue *obj, - double *value, - char **text) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return; - - *value = gtk_adjustment_get_value (adjustment); - *text = NULL; -} - -static AtkRange * -gtk_scale_button_accessible_get_range (AtkValue *obj) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return NULL; - - return atk_range_new (gtk_adjustment_get_lower (adjustment), - gtk_adjustment_get_upper (adjustment), - NULL); -} - -static void -gtk_scale_button_accessible_set_value (AtkValue *obj, - const double value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return; - - gtk_adjustment_set_value (adjustment, value); -} - -static double -gtk_scale_button_accessible_get_increment (AtkValue *obj) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget)); - if (adjustment == NULL) - return 0; - - return gtk_adjustment_get_minimum_increment (adjustment); -} - -static void -atk_value_interface_init (AtkValueIface *iface) -{ - iface->get_current_value = gtk_scale_button_accessible_get_current_value; - iface->get_maximum_value = gtk_scale_button_accessible_get_maximum_value; - iface->get_minimum_value = gtk_scale_button_accessible_get_minimum_value; - iface->get_minimum_increment = gtk_scale_button_accessible_get_minimum_increment; - iface->set_current_value = gtk_scale_button_accessible_set_current_value; - - iface->get_value_and_text = gtk_scale_button_accessible_get_value_and_text; - iface->get_range = gtk_scale_button_accessible_get_range; - iface->set_value = gtk_scale_button_accessible_set_value; - iface->get_increment = gtk_scale_button_accessible_get_increment; -} diff --git a/gtk/a11y/gtkscalebuttonaccessible.h b/gtk/a11y/gtkscalebuttonaccessible.h deleted file mode 100644 index 7b0538bdb4..0000000000 --- a/gtk/a11y/gtkscalebuttonaccessible.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2008 Jan Arne Petersen <jap@gnome.org> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_SCALE_BUTTON_ACCESSIBLE_H__ -#define __GTK_SCALE_BUTTON_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkbuttonaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_SCALE_BUTTON_ACCESSIBLE (gtk_scale_button_accessible_get_type ()) -#define GTK_SCALE_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE, GtkScaleButtonAccessible)) -#define GTK_SCALE_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE, GtkScaleButtonAccessibleClass)) -#define GTK_IS_SCALE_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE)) -#define GTK_IS_SCALE_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE)) -#define GTK_SCALE_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE, GtkScaleButtonAccessibleClass)) - -typedef struct _GtkScaleButtonAccessible GtkScaleButtonAccessible; -typedef struct _GtkScaleButtonAccessibleClass GtkScaleButtonAccessibleClass; - -struct _GtkScaleButtonAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkScaleButtonAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_scale_button_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_SCALE_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkscrollbaraccessible.c b/gtk/a11y/gtkscrollbaraccessible.c deleted file mode 100644 index 6a65ecf9de..0000000000 --- a/gtk/a11y/gtkscrollbaraccessible.c +++ /dev/null @@ -1,293 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtkscrollbaraccessible.h" - -typedef struct -{ - GtkAdjustment *adjustment; - gulong value_changed_id; -} GtkScrollbarAccessiblePrivate; - -static void atk_value_interface_init (AtkValueIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkScrollbarAccessible, gtk_scrollbar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkScrollbarAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) - -static void -on_value_changed (GtkAdjustment *adjustment, - gpointer data) -{ - GtkScrollbarAccessible *self = data; - - g_object_notify (G_OBJECT (self), "accessible-value"); -} - -static void -on_adjustment_changed (GObject *gobject, - GParamSpec *pspec, - gpointer data) -{ - GtkScrollbar *scrollbar = GTK_SCROLLBAR (gobject); - GtkScrollbarAccessible *self = data; - GtkScrollbarAccessiblePrivate *priv = - gtk_scrollbar_accessible_get_instance_private (self); - GtkAdjustment *adjustment = - gtk_scrollbar_get_adjustment (scrollbar); - - if (priv->adjustment == adjustment) - return; - - if (priv->adjustment != NULL && priv->value_changed_id != 0) - { - g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id); - priv->value_changed_id = 0; - } - - g_clear_object (&priv->adjustment); - - if (adjustment != NULL) - { - priv->adjustment = g_object_ref (adjustment); - priv->value_changed_id = - g_signal_connect (priv->adjustment, "value-changed", - G_CALLBACK (on_value_changed), - self); - } -} - -static void -gtk_scrollbar_accessible_dispose (GObject *gobject) -{ - GtkScrollbarAccessible *self = GTK_SCROLLBAR_ACCESSIBLE (gobject); - GtkScrollbarAccessiblePrivate *priv = - gtk_scrollbar_accessible_get_instance_private (self); - - if (priv->adjustment != NULL && priv->value_changed_id != 0) - { - g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id); - priv->value_changed_id = 0; - } - - g_clear_object (&priv->adjustment); - - G_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->dispose (gobject); -} - -static void -gtk_scrollbar_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkScrollbar *scrollbar = data; - - ATK_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->initialize (obj, data); - - g_signal_connect (scrollbar, "notify::adjustment", - G_CALLBACK (on_adjustment_changed), - obj); -} - -static void -gtk_scrollbar_accessible_class_init (GtkScrollbarAccessibleClass *klass) -{ - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - atk_object_class->initialize = gtk_scrollbar_accessible_initialize; - - gobject_class->dispose = gtk_scrollbar_accessible_dispose; -} - -static void -gtk_scrollbar_accessible_init (GtkScrollbarAccessible *self) -{ - ATK_OBJECT (self)->role = ATK_ROLE_SCROLL_BAR; -} - -static void -gtk_scrollbar_accessible_get_current_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_value (adjustment)); -} - -static void -gtk_scrollbar_accessible_get_maximum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - double max; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return; - - max = gtk_adjustment_get_upper (adjustment) - - gtk_adjustment_get_page_size (adjustment); - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, max); -} - -static void -gtk_scrollbar_accessible_get_minimum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_lower (adjustment)); -} - -static void -gtk_scrollbar_accessible_get_minimum_increment (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_minimum_increment (adjustment)); -} - -static gboolean -gtk_scrollbar_accessible_set_current_value (AtkValue *obj, - const GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return FALSE; - - gtk_adjustment_set_value (adjustment, g_value_get_double (value)); - - return TRUE; -} - -static void -gtk_scrollbar_accessible_get_value_and_text (AtkValue *obj, - double *value, - char **text) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return; - - *value = gtk_adjustment_get_value (adjustment); - *text = NULL; -} - -static AtkRange * -gtk_scrollbar_accessible_get_range (AtkValue *obj) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - double min, max; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return NULL; - - min = gtk_adjustment_get_lower (adjustment); - max = gtk_adjustment_get_upper (adjustment) - - gtk_adjustment_get_page_size (adjustment); - - return atk_range_new (min, max, NULL); -} - -static void -gtk_scrollbar_accessible_set_value (AtkValue *obj, - const double value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return; - - gtk_adjustment_set_value (adjustment, value); -} - -static double -gtk_scrollbar_accessible_get_increment (AtkValue *obj) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget)); - if (adjustment == NULL) - return 0; - - return gtk_adjustment_get_minimum_increment (adjustment); -} - -static void -atk_value_interface_init (AtkValueIface *iface) -{ - iface->get_current_value = gtk_scrollbar_accessible_get_current_value; - iface->get_maximum_value = gtk_scrollbar_accessible_get_maximum_value; - iface->get_minimum_value = gtk_scrollbar_accessible_get_minimum_value; - iface->get_minimum_increment = gtk_scrollbar_accessible_get_minimum_increment; - iface->set_current_value = gtk_scrollbar_accessible_set_current_value; - - iface->get_value_and_text = gtk_scrollbar_accessible_get_value_and_text; - iface->get_range = gtk_scrollbar_accessible_get_range; - iface->set_value = gtk_scrollbar_accessible_set_value; - iface->get_increment = gtk_scrollbar_accessible_get_increment; -} diff --git a/gtk/a11y/gtkscrollbaraccessible.h b/gtk/a11y/gtkscrollbaraccessible.h deleted file mode 100644 index bac0e3fd48..0000000000 --- a/gtk/a11y/gtkscrollbaraccessible.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_SCROLLBAR_ACCESSIBLE_H__ -#define __GTK_SCROLLBAR_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_SCROLLBAR_ACCESSIBLE (gtk_scrollbar_accessible_get_type ()) -#define GTK_SCROLLBAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessible)) -#define GTK_SCROLLBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessibleClass)) -#define GTK_IS_SCROLLBAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE)) -#define GTK_IS_SCROLLBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCROLLBAR_ACCESSIBLE)) -#define GTK_SCROLLBAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessibleClass)) - -typedef struct _GtkScrollbarAccessible GtkScrollbarAccessible; -typedef struct _GtkScrollbarAccessibleClass GtkScrollbarAccessibleClass; - -struct _GtkScrollbarAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkScrollbarAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_scrollbar_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_SCROLLBAR_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkscrolledwindowaccessible.c b/gtk/a11y/gtkscrolledwindowaccessible.c deleted file mode 100644 index 9856f858b2..0000000000 --- a/gtk/a11y/gtkscrolledwindowaccessible.c +++ /dev/null @@ -1,173 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtkscrolledwindowaccessible.h" - - -G_DEFINE_TYPE (GtkScrolledWindowAccessible, gtk_scrolled_window_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static void -visibility_changed (GObject *object, - GParamSpec *pspec, - gpointer user_data) -{ - if (!g_strcmp0 (pspec->name, "visible")) - { - int index; - int n_children; - gboolean child_added = FALSE; - AtkObject *child; - GtkWidget *widget; - GtkScrolledWindow *scrolled_window; - GtkWidget *hscrollbar, *vscrollbar; - GtkAccessible *accessible = GTK_ACCESSIBLE (user_data); - - widget = gtk_accessible_get_widget (user_data); - if (widget == NULL) - return; - - scrolled_window = GTK_SCROLLED_WINDOW (widget); - index = n_children = 1; - - hscrollbar = gtk_scrolled_window_get_hscrollbar (scrolled_window); - vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window); - - if ((gpointer) object == (gpointer) (hscrollbar)) - { - if (gtk_scrolled_window_get_hscrollbar (scrolled_window)) - child_added = TRUE; - - child = gtk_widget_get_accessible (hscrollbar); - } - else if ((gpointer) object == (gpointer) (vscrollbar)) - { - if (gtk_scrolled_window_get_vscrollbar (scrolled_window)) - child_added = TRUE; - - child = gtk_widget_get_accessible (vscrollbar); - if (gtk_scrolled_window_get_hscrollbar (scrolled_window)) - index = n_children + 1; - } - else - { - g_assert_not_reached (); - return; - } - - if (child_added) - g_signal_emit_by_name (accessible, "children-changed::add", index, child, NULL); - else - g_signal_emit_by_name (accessible, "children-changed::remove", index, child, NULL); - - } -} - -static void -gtk_scrolled_window_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkScrolledWindow *window; - - ATK_OBJECT_CLASS (gtk_scrolled_window_accessible_parent_class)->initialize (obj, data); - - window = GTK_SCROLLED_WINDOW (data); - - g_signal_connect_object (gtk_scrolled_window_get_hscrollbar (window), "notify::visible", - G_CALLBACK (visibility_changed), - obj, 0); - g_signal_connect_object (gtk_scrolled_window_get_vscrollbar (window), "notify::visible", - G_CALLBACK (visibility_changed), - obj, 0); - - obj->role = ATK_ROLE_SCROLL_PANE; -} - -static int -gtk_scrolled_window_accessible_get_n_children (AtkObject *object) -{ - GtkWidget *widget; - GtkScrolledWindow *scrolled_window; - int n_children; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); - if (widget == NULL) - return 0; - - scrolled_window = GTK_SCROLLED_WINDOW (widget); - - n_children = 0; - if (gtk_scrolled_window_get_child (scrolled_window)) - n_children++; - if (gtk_scrolled_window_get_hscrollbar (scrolled_window)) - n_children++; - if (gtk_scrolled_window_get_vscrollbar (scrolled_window)) - n_children++; - - return n_children; -} - -static AtkObject * -gtk_scrolled_window_accessible_ref_child (AtkObject *obj, - int child) -{ - GtkWidget *widget; - GtkScrolledWindow *scrolled_window; - GtkWidget *hscrollbar, *vscrollbar; - GtkWidget *c; - GtkWidget *chosen = NULL; - - g_return_val_if_fail (child >= 0, NULL); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - scrolled_window = GTK_SCROLLED_WINDOW (widget); - c = gtk_scrolled_window_get_child (scrolled_window); - hscrollbar = gtk_scrolled_window_get_hscrollbar (scrolled_window); - vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window); - - if (child == 2) - chosen = vscrollbar; - else if (child == 1) - chosen = c ? hscrollbar : vscrollbar; - else if (child == 0) - chosen = c ? c : (hscrollbar ? hscrollbar : vscrollbar); - - if (chosen) - return g_object_ref (gtk_widget_get_accessible (chosen)); - - return NULL; -} - -static void -gtk_scrolled_window_accessible_class_init (GtkScrolledWindowAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_n_children = gtk_scrolled_window_accessible_get_n_children; - class->ref_child = gtk_scrolled_window_accessible_ref_child; - class->initialize = gtk_scrolled_window_accessible_initialize; -} - -static void -gtk_scrolled_window_accessible_init (GtkScrolledWindowAccessible *window) -{ -} diff --git a/gtk/a11y/gtkscrolledwindowaccessible.h b/gtk/a11y/gtkscrolledwindowaccessible.h deleted file mode 100644 index 56d9ff8ec6..0000000000 --- a/gtk/a11y/gtkscrolledwindowaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_SCROLLED_WINDOW_ACCESSIBLE_H__ -#define __GTK_SCROLLED_WINDOW_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE (gtk_scrolled_window_accessible_get_type ()) -#define GTK_SCROLLED_WINDOW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE, GtkScrolledWindowAccessible)) -#define GTK_SCROLLED_WINDOW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE, GtkScrolledWindowAccessibleClass)) -#define GTK_IS_SCROLLED_WINDOW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE)) -#define GTK_IS_SCROLLED_WINDOW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE)) -#define GTK_SCROLLED_WINDOW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE, GtkScrolledWindowAccessibleClass)) - -typedef struct _GtkScrolledWindowAccessible GtkScrolledWindowAccessible; -typedef struct _GtkScrolledWindowAccessibleClass GtkScrolledWindowAccessibleClass; -typedef struct _GtkScrolledWindowAccessiblePrivate GtkScrolledWindowAccessiblePrivate; - -struct _GtkScrolledWindowAccessible -{ - GtkWidgetAccessible parent; - - GtkScrolledWindowAccessiblePrivate *priv; -}; - -struct _GtkScrolledWindowAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_scrolled_window_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_SCROLLED_WINDOW_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtksearchentryaccessible.c b/gtk/a11y/gtksearchentryaccessible.c deleted file mode 100644 index 27b009971e..0000000000 --- a/gtk/a11y/gtksearchentryaccessible.c +++ /dev/null @@ -1,1010 +0,0 @@ -/* gtksearchentryaccessible.c: GtkWidgetAccessible for GtkSearchEntry - * - * 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/>. - */ - -#include "config.h" - -#include "gtksearchentryaccessible.h" - -#include "gtkeditable.h" -#include "gtkimage.h" -#include "gtkintl.h" -#include "gtklabel.h" -#include "gtkpango.h" -#include "gtksearchentryprivate.h" -#include "gtkstylecontextprivate.h" -#include "gtktextprivate.h" - -struct _GtkSearchEntryAccessible -{ - GtkWidgetAccessible parent_instance; - - int cursor_position; - int selection_bound; -}; - -static void atk_editable_text_interface_init (AtkEditableTextIface *iface); -static void atk_text_interface_init (AtkTextIface *iface); -static void atk_action_interface_init (AtkActionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkSearchEntryAccessible, gtk_search_entry_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - -static inline GtkText * -get_text_widget (GtkAccessible *accessible) -{ - GtkSearchEntry *search_entry = - GTK_SEARCH_ENTRY (gtk_accessible_get_widget (accessible)); - - if (search_entry == NULL) - return NULL; - - return gtk_search_entry_get_text_widget (search_entry); -} - -static gboolean -check_for_selection_change (GtkSearchEntryAccessible *self, - GtkEditable *editable) -{ - gboolean ret_val = FALSE; - int start, end; - - if (gtk_editable_get_selection_bounds (editable, &start, &end)) - { - if (end != self->cursor_position || - start != self->selection_bound) - /* - * This check is here as this function can be called - * for notification of selection_bound and current_pos. - * The values of current_pos and selection_bound may be the same - * for both notifications and we only want to generate one - * text_selection_changed signal. - */ - ret_val = TRUE; - } - else - { - /* We had a selection */ - ret_val = (self->cursor_position != self->selection_bound); - } - - self->cursor_position = end; - self->selection_bound = start; - - return ret_val; -} - -static void -insert_text_cb (GtkEditable *editable, - char *new_text, - int new_text_length, - int *position, - GtkSearchEntryAccessible *self) -{ - int length; - - if (new_text_length == 0) - return; - - length = g_utf8_strlen (new_text, new_text_length); - - g_signal_emit_by_name (self, - "text-changed::insert", - *position - length, - length); -} - -static void -delete_text_cb (GtkEditable *editable, - int start, - int end, - GtkSearchEntryAccessible *self) -{ - GtkText *text; - - text = get_text_widget (GTK_ACCESSIBLE (self)); - if (text == NULL) - return; - - if (end < 0) - { - char *contents; - - contents = gtk_text_get_display_text (text, 0, -1); - end = g_utf8_strlen (contents, -1); - - g_free (contents); - } - - if (end == start) - return; - - g_signal_emit_by_name (self, - "text-changed::delete", - start, - end - start); -} - -static int -gtk_search_entry_accessible_get_n_children (AtkObject *object) -{ - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); - if (widget == NULL) - return 0; - - int count = 0; - for (GtkWidget *child = gtk_widget_get_first_child (widget); - child != NULL; - child = gtk_widget_get_next_sibling (child)) - { - if (GTK_IS_IMAGE (child) && gtk_widget_get_child_visible (child)) - count += 1; - } - - return count; -} - -static AtkObject * -gtk_search_entry_accessible_ref_child (AtkObject *obj, - int i) -{ - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - for (GtkWidget *child = gtk_widget_get_first_child (widget); - child != NULL; - child = gtk_widget_get_next_sibling (child)) - { - if (GTK_IS_IMAGE (child) && gtk_widget_get_child_visible (child)) - return g_object_ref (gtk_widget_get_accessible (child)); - } - - return NULL; -} - -static AtkAttributeSet * -gtk_search_entry_accessible_get_attributes (AtkObject *accessible) -{ - GtkWidget *widget; - AtkAttributeSet *attributes; - AtkAttribute *placeholder_text; - char *text = NULL; - - attributes = ATK_OBJECT_CLASS (gtk_search_entry_accessible_parent_class)->get_attributes (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return attributes; - - g_object_get (widget, "placeholder-text", &text, NULL); - if (text == NULL) - return attributes; - - placeholder_text = g_malloc (sizeof (AtkAttribute)); - placeholder_text->name = g_strdup ("placeholder-text"); - placeholder_text->value = text; - - attributes = g_slist_append (attributes, placeholder_text); - - return attributes; -} - -static void -on_cursor_position_changed (GObject *gobject, - GParamSpec *pspec, - gpointer data) -{ - GtkSearchEntryAccessible *self = data; - GtkEditable *editable = GTK_EDITABLE (gobject); - - if (check_for_selection_change (self, editable)) - g_signal_emit_by_name (self, "text-selection-changed"); - - // The entry cursor position has moved so generate the signal - g_signal_emit_by_name (self, "text-caret-moved", - gtk_editable_get_position (editable)); -} - -static void -on_selection_bound_changed (GObject *gobject, - GParamSpec *pspec, - gpointer data) -{ - GtkSearchEntryAccessible *self = data; - GtkEditable *editable = GTK_EDITABLE (gobject); - - if (check_for_selection_change (self, editable)) - g_signal_emit_by_name (self, "text-selection-changed"); -} - -static void -gtk_search_entry_accessible_initialize (AtkObject *object, - gpointer data) -{ - GtkSearchEntryAccessible *self = GTK_SEARCH_ENTRY_ACCESSIBLE (object); - GtkEditable *editable = data; - GtkWidget *widget = data; - int start_pos, end_pos; - - gtk_editable_get_selection_bounds (editable, &start_pos, &end_pos); - self->cursor_position = end_pos; - self->selection_bound = start_pos; - - /* Set up signal callbacks */ - g_signal_connect_after (widget, "insert-text", G_CALLBACK (insert_text_cb), self); - g_signal_connect (widget, "delete-text", G_CALLBACK (delete_text_cb), self); - g_signal_connect (widget, "notify::cursor-position", - G_CALLBACK (on_cursor_position_changed), self); - g_signal_connect (widget, "notify::selection-bound", - G_CALLBACK (on_selection_bound_changed), self); -} - -static void -gtk_search_entry_accessible_class_init (GtkSearchEntryAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->initialize = gtk_search_entry_accessible_initialize; - class->get_attributes = gtk_search_entry_accessible_get_attributes; - class->get_n_children = gtk_search_entry_accessible_get_n_children; - class->ref_child = gtk_search_entry_accessible_ref_child; -} - -static void -gtk_search_entry_accessible_init (GtkSearchEntryAccessible *self) -{ - AtkObject *atk_obj = ATK_OBJECT (self); - - atk_obj->role = ATK_ROLE_TEXT; - atk_object_set_name (atk_obj, _("Search")); -} - -static char * -gtk_search_entry_accessible_get_text (AtkText *atk_text, - int start_pos, - int end_pos) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - - if (text == NULL) - return NULL; - - return gtk_text_get_display_text (text, start_pos, end_pos); -} - -static char * -gtk_search_entry_accessible_get_text_before_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - - if (text == NULL) - return NULL; - - return _gtk_pango_get_text_before (gtk_text_get_layout (text), - boundary_type, offset, - start_offset, end_offset); -} - -static char * -gtk_search_entry_accessible_get_text_at_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - - if (text == NULL) - return NULL; - - return _gtk_pango_get_text_at (gtk_text_get_layout (text), - boundary_type, offset, - start_offset, end_offset); -} - -static char * -gtk_search_entry_accessible_get_text_after_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - - if (text == NULL) - return NULL; - - return _gtk_pango_get_text_after (gtk_text_get_layout (text), - boundary_type, offset, - start_offset, end_offset); -} - -static int -gtk_search_entry_accessible_get_character_count (AtkText *atk_text) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - if (text == NULL) - return 0; - - char *display_text = gtk_text_get_display_text (text, 0, -1); - - int char_count = 0; - if (display_text) - { - char_count = g_utf8_strlen (display_text, -1); - g_free (display_text); - } - - return char_count; -} - -static int -gtk_search_entry_accessible_get_caret_offset (AtkText *atk_text) -{ - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - - if (widget == NULL) - return -1; - - int cursor_position = 0; - gboolean result = gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), NULL, &cursor_position); - if (!result) - return -1; - - return cursor_position; -} - -static gboolean -gtk_search_entry_accessible_set_caret_offset (AtkText *atk_text, - int offset) -{ - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return FALSE; - - gtk_editable_set_position (GTK_EDITABLE (widget), offset); - - return TRUE; -} - -static AtkAttributeSet * -add_text_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - int i) -{ - AtkAttribute *at; - - at = g_new (AtkAttribute, 1); - at->name = g_strdup (atk_text_attribute_get_name (attr)); - at->value = g_strdup (atk_text_attribute_get_value (attr, i)); - - return g_slist_prepend (attributes, at); -} - -static AtkAttributeSet * -gtk_search_entry_accessible_get_run_attributes (AtkText *atk_text, - int offset, - int *start_offset, - int *end_offset) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - - if (text == NULL) - return NULL; - - AtkAttributeSet *attributes = NULL; - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (GTK_WIDGET (text))); - attributes = _gtk_pango_get_run_attributes (attributes, - gtk_text_get_layout (text), - offset, - start_offset, - end_offset); - - return attributes; -} - -static AtkAttributeSet * -gtk_search_entry_accessible_get_default_attributes (AtkText *atk_text) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - - if (text == NULL) - return NULL; - - AtkAttributeSet *attributes = NULL; - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (GTK_WIDGET (text))); - attributes = _gtk_pango_get_default_attributes (attributes, - gtk_text_get_layout (text)); - attributes = _gtk_style_context_get_attributes (attributes, - gtk_widget_get_style_context (GTK_WIDGET (text))); - - return attributes; -} - -static void -gtk_search_entry_accessible_get_character_extents (AtkText *atk_text, - int offset, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coords) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - PangoRectangle char_rect; - char *entry_text; - int index, x_layout, y_layout; - GtkAllocation allocation; - - if (text == NULL) - return; - - gtk_text_get_layout_offsets (text, &x_layout, &y_layout); - entry_text = gtk_text_get_display_text (text, 0, -1); - index = g_utf8_offset_to_pointer (entry_text, offset) - entry_text; - g_free (entry_text); - - pango_layout_index_to_pos (gtk_text_get_layout (text), index, &char_rect); - pango_extents_to_pixels (&char_rect, NULL); - - gtk_widget_get_allocation (GTK_WIDGET (text), &allocation); - - *x = allocation.x + x_layout + char_rect.x; - *y = allocation.y + y_layout + char_rect.y; - *width = char_rect.width; - *height = char_rect.height; -} - -static int -gtk_search_entry_accessible_get_offset_at_point (AtkText *atk_text, - int x, - int y, - AtkCoordType coords) -{ - GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - int index, x_layout, y_layout; - int x_local, y_local; - glong offset; - - if (text == NULL) - return 1; - - gtk_text_get_layout_offsets (text, &x_layout, &y_layout); - - x_local = x - x_layout; - y_local = y - y_layout; - - if (!pango_layout_xy_to_index (gtk_text_get_layout (text), - x_local * PANGO_SCALE, - y_local * PANGO_SCALE, - &index, NULL)) - { - if (x_local < 0 || y_local < 0) - index = 0; - else - index = -1; - } - - offset = -1; - if (index != -1) - { - char *entry_text = gtk_text_get_display_text (text, 0, -1); - offset = g_utf8_pointer_to_offset (entry_text, entry_text + index); - g_free (entry_text); - } - - return offset; -} - -static int -gtk_search_entry_accessible_get_n_selections (AtkText *text) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return 0; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - return 1; - - return 0; -} - -static char * -gtk_search_entry_accessible_get_selection (AtkText *text, - int selection_num, - int *start_pos, - int *end_pos) -{ - GtkEditable *editable; - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - if (selection_num != 0) - return NULL; - - editable = GTK_EDITABLE (widget); - if (gtk_editable_get_selection_bounds (editable, &start, &end)) - { - if (start_pos != NULL) - *start_pos = start; - if (end_pos != NULL) - *end_pos = end; - - return gtk_editable_get_chars (editable, start, end); - } - - return NULL; -} - -static gboolean -gtk_search_entry_accessible_add_selection (AtkText *text, - int start_pos, - int end_pos) -{ - GtkEntry *entry; - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - entry = GTK_ENTRY (widget); - - if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (entry), start_pos, end_pos); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_search_entry_accessible_remove_selection (AtkText *text, - int selection_num) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (widget), end, end); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_search_entry_accessible_set_selection (AtkText *text, - int selection_num, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (widget), start_pos, end_pos); - return TRUE; - } - else - return FALSE; -} - -static gunichar -gtk_search_entry_accessible_get_character_at_offset (AtkText *atk_text, - int offset) -{ - GtkText *text; - char *contents; - char *index; - gunichar result; - - result = '\0'; - - text = get_text_widget (GTK_ACCESSIBLE (atk_text)); - if (text == NULL) - return 0; - - if (!gtk_text_get_visibility (text)) - return result; - - contents = gtk_text_get_display_text (text, 0, -1); - if (offset < g_utf8_strlen (contents, -1)) - { - index = g_utf8_offset_to_pointer (contents, offset); - result = g_utf8_get_char (index); - g_free (contents); - } - - return result; -} - -static void -atk_text_interface_init (AtkTextIface *iface) -{ - iface->get_text = gtk_search_entry_accessible_get_text; - iface->get_character_at_offset = gtk_search_entry_accessible_get_character_at_offset; - iface->get_text_before_offset = gtk_search_entry_accessible_get_text_before_offset; - iface->get_text_at_offset = gtk_search_entry_accessible_get_text_at_offset; - iface->get_text_after_offset = gtk_search_entry_accessible_get_text_after_offset; - iface->get_caret_offset = gtk_search_entry_accessible_get_caret_offset; - iface->set_caret_offset = gtk_search_entry_accessible_set_caret_offset; - iface->get_character_count = gtk_search_entry_accessible_get_character_count; - iface->get_n_selections = gtk_search_entry_accessible_get_n_selections; - iface->get_selection = gtk_search_entry_accessible_get_selection; - iface->add_selection = gtk_search_entry_accessible_add_selection; - iface->remove_selection = gtk_search_entry_accessible_remove_selection; - iface->set_selection = gtk_search_entry_accessible_set_selection; - iface->get_run_attributes = gtk_search_entry_accessible_get_run_attributes; - iface->get_default_attributes = gtk_search_entry_accessible_get_default_attributes; - iface->get_character_extents = gtk_search_entry_accessible_get_character_extents; - iface->get_offset_at_point = gtk_search_entry_accessible_get_offset_at_point; -} - -static void -gtk_search_entry_accessible_set_text_contents (AtkEditableText *text, - const char *string) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - if (!gtk_editable_get_editable (GTK_EDITABLE (widget))) - return; - - gtk_editable_set_text (GTK_EDITABLE (widget), string); -} - -static void -gtk_search_entry_accessible_insert_text (AtkEditableText *text, - const char *string, - int length, - int *position) -{ - GtkWidget *widget; - GtkEditable *editable; - int pos = 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - if (position != NULL) - pos = *position; - - gtk_editable_insert_text (editable, string, length, &pos); - gtk_editable_set_position (editable, pos); - - if (position != NULL) - *position = pos; -} - -static void -gtk_search_entry_accessible_copy_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - GdkClipboard *clipboard; - char *str; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - str = gtk_editable_get_chars (editable, start_pos, end_pos); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_set_text (clipboard, str); - g_free (str); -} - -static void -gtk_search_entry_accessible_cut_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - GdkClipboard *clipboard; - char *str; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - str = gtk_editable_get_chars (editable, start_pos, end_pos); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_set_text (clipboard, str); - gtk_editable_delete_text (editable, start_pos, end_pos); -} - -static void -gtk_search_entry_accessible_delete_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - gtk_editable_delete_text (editable, start_pos, end_pos); -} - -typedef struct -{ - GtkEditable *entry; - int position; -} PasteData; - -static void -paste_received_cb (GObject *clipboard, - GAsyncResult *result, - gpointer data) -{ - PasteData *paste = data; - char *text; - - text = gdk_clipboard_read_text_finish (GDK_CLIPBOARD (clipboard), result, NULL); - if (text != NULL) - gtk_editable_insert_text (paste->entry, - text, -1, - &(paste->position)); - - g_object_unref (paste->entry); - g_free (paste); - g_free (text); -} - -static void -gtk_search_entry_accessible_paste_text (AtkEditableText *text, - int position) -{ - GtkWidget *widget; - GtkEditable *editable; - PasteData *paste; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - paste = g_new0 (PasteData, 1); - paste->entry = GTK_EDITABLE (widget); - paste->position = position; - - g_object_ref (paste->entry); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_read_text_async (clipboard, NULL, paste_received_cb, paste); -} - -static void -atk_editable_text_interface_init (AtkEditableTextIface *iface) -{ - iface->set_text_contents = gtk_search_entry_accessible_set_text_contents; - iface->insert_text = gtk_search_entry_accessible_insert_text; - iface->copy_text = gtk_search_entry_accessible_copy_text; - iface->cut_text = gtk_search_entry_accessible_cut_text; - iface->delete_text = gtk_search_entry_accessible_delete_text; - iface->paste_text = gtk_search_entry_accessible_paste_text; - iface->set_run_attributes = NULL; -} - -static gboolean -gtk_search_entry_accessible_do_action (AtkAction *action, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - if (i == 0) - { - gtk_widget_activate (widget); - return TRUE; - } - - if (i == 1) - { - gtk_editable_set_text (GTK_EDITABLE (widget), ""); - return TRUE; - } - - return FALSE; -} - -static int -gtk_search_entry_accessible_get_n_actions (AtkAction *action) -{ - GtkAccessible *accessible = GTK_ACCESSIBLE (action); - - GtkWidget *widget = gtk_accessible_get_widget (accessible); - if (widget == NULL) - return 0; - - // If the SearchEntry widget contains text, we have a second action - // to clear its contents - int n_actions = 1; - const char *str = gtk_editable_get_text (GTK_EDITABLE (widget)); - if (str != NULL && *str != '\0') - n_actions += 1; - - return n_actions; -} - -static const char * -gtk_search_entry_accessible_get_keybinding (AtkAction *action, - int i) -{ - GtkWidget *widget; - GtkWidget *label; - AtkRelationSet *set; - AtkRelation *relation; - GPtrArray *target; - gpointer target_object; - guint key_val; - - if (i != 0) - return NULL; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return NULL; - - set = atk_object_ref_relation_set (ATK_OBJECT (action)); - if (!set) - return NULL; - - label = NULL; - relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY); - if (relation) - { - target = atk_relation_get_target (relation); - - target_object = g_ptr_array_index (target, 0); - label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object)); - } - - g_object_unref (set); - - if (GTK_IS_LABEL (label)) - { - key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); - if (key_val != GDK_KEY_VoidSymbol) - return gtk_accelerator_name (key_val, GDK_ALT_MASK); - } - - return NULL; -} - -static const char * -gtk_search_entry_accessible_action_get_name (AtkAction *action, - int i) -{ - switch (i) - { - case 0: - return "activate"; - - case 1: - return "clear"; - - default: - break; - } - - return NULL; -} - -static const char * -gtk_search_entry_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Activate"); - if (i == 1) - return C_("Action name", "Clear"); - - return NULL; -} - -static const char * -gtk_search_entry_accessible_action_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Activates the entry"); - - if (i == 1) - return C_("Action description", "Clears the entry"); - - return NULL; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_search_entry_accessible_do_action; - iface->get_n_actions = gtk_search_entry_accessible_get_n_actions; - iface->get_keybinding = gtk_search_entry_accessible_get_keybinding; - iface->get_name = gtk_search_entry_accessible_action_get_name; - iface->get_localized_name = gtk_search_entry_accessible_action_get_localized_name; - iface->get_description = gtk_search_entry_accessible_action_get_description; -} diff --git a/gtk/a11y/gtksearchentryaccessible.h b/gtk/a11y/gtksearchentryaccessible.h deleted file mode 100644 index 9fd2d559df..0000000000 --- a/gtk/a11y/gtksearchentryaccessible.h +++ /dev/null @@ -1,48 +0,0 @@ -/* gtksearchentryaccessible.h: A GtkWidgetAccessible for GtkSearchEntry - * - * 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/>. - */ - -#pragma once - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkentryaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_SEARCH_ENTRY_ACCESSIBLE (gtk_search_entry_accessible_get_type()) -#define GTK_SEARCH_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SEARCH_ENTRY_ACCESSIBLE, GtkSearchEntryAccessible)) -#define GTK_IS_SEARCH_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SEARCH_ENTRY_ACCESSIBLE)) - -typedef struct _GtkSearchEntryAccessible GtkSearchEntryAccessible; -typedef struct _GtkSearchEntryAccessibleClass GtkSearchEntryAccessibleClass; - -struct _GtkSearchEntryAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_search_entry_accessible_get_type (void) G_GNUC_CONST; - -G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkSearchEntryAccessible, g_object_unref) - -G_END_DECLS diff --git a/gtk/a11y/gtkspinbuttonaccessible.c b/gtk/a11y/gtkspinbuttonaccessible.c deleted file mode 100644 index 0791b4e9e4..0000000000 --- a/gtk/a11y/gtkspinbuttonaccessible.c +++ /dev/null @@ -1,277 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtkspinbuttonaccessible.h" - -struct _GtkSpinButtonAccessiblePrivate -{ - GtkAdjustment *adjustment; - gulong value_changed_id; -}; - -static void atk_value_interface_init (AtkValueIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkSpinButtonAccessible, gtk_spin_button_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkSpinButtonAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) - -static void -on_value_changed (GtkAdjustment *adjustment, - GtkSpinButtonAccessible *self) -{ - g_object_notify (G_OBJECT (self), "accessible-value"); -} - -static void -on_adjustment_changed (GObject *gobject, - GParamSpec *pspec, - gpointer data) -{ - GtkSpinButton *spin = GTK_SPIN_BUTTON (gobject); - GtkSpinButtonAccessible *self = data; - GtkSpinButtonAccessiblePrivate *priv = gtk_spin_button_accessible_get_instance_private (self); - GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (spin); - - if (priv->adjustment == adjustment) - return; - - if (priv->adjustment != NULL && priv->value_changed_id != 0) - { - g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id); - priv->value_changed_id = 0; - } - - g_clear_object (&priv->adjustment); - - if (adjustment != NULL) - { - priv->adjustment = g_object_ref (adjustment); - priv->value_changed_id = g_signal_connect (priv->adjustment, "value-changed", - G_CALLBACK (on_value_changed), - self); - } -} - -static void -gtk_spin_button_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_spin_button_accessible_parent_class)->initialize (obj, data); - - g_signal_connect (data, "notify::adjustment", G_CALLBACK (on_adjustment_changed), obj); -} - -static void -gtk_spin_button_accessible_dispose (GObject *gobject) -{ - GtkSpinButtonAccessible *self = GTK_SPIN_BUTTON_ACCESSIBLE (gobject); - GtkSpinButtonAccessiblePrivate *priv = - gtk_spin_button_accessible_get_instance_private (self); - - if (priv->adjustment != NULL && priv->value_changed_id != 0) - { - g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id); - priv->value_changed_id = 0; - } - - g_clear_object (&priv->adjustment); - - G_OBJECT_CLASS (gtk_spin_button_accessible_parent_class)->dispose (gobject); -} - -static void -gtk_spin_button_accessible_class_init (GtkSpinButtonAccessibleClass *klass) -{ - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - atk_object_class->initialize = gtk_spin_button_accessible_initialize; - - gobject_class->dispose = gtk_spin_button_accessible_dispose; -} - -static void -gtk_spin_button_accessible_init (GtkSpinButtonAccessible *self) -{ - ATK_OBJECT (self)->role = ATK_ROLE_SPIN_BUTTON; -} - -static void -gtk_spin_button_accessible_get_current_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_value (adjustment)); -} - -static void -gtk_spin_button_accessible_get_maximum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_upper (adjustment)); -} - -static void -gtk_spin_button_accessible_get_minimum_value (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_lower (adjustment)); -} - -static void -gtk_spin_button_accessible_get_minimum_increment (AtkValue *obj, - GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return; - - memset (value, 0, sizeof (GValue)); - g_value_init (value, G_TYPE_DOUBLE); - g_value_set_double (value, gtk_adjustment_get_minimum_increment (adjustment)); -} - -static gboolean -gtk_spin_button_accessible_set_current_value (AtkValue *obj, - const GValue *value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return FALSE; - - gtk_adjustment_set_value (adjustment, g_value_get_double (value)); - - return TRUE; -} - -static void -gtk_spin_button_accessible_get_value_and_text (AtkValue *obj, - double *value, - char **text) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return; - - *value = gtk_adjustment_get_value (adjustment); - *text = NULL; -} - -static AtkRange * -gtk_spin_button_accessible_get_range (AtkValue *obj) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return NULL; - - return atk_range_new (gtk_adjustment_get_lower (adjustment), - gtk_adjustment_get_upper (adjustment), - NULL); -} - -static void -gtk_spin_button_accessible_set_value (AtkValue *obj, - const double value) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return; - - gtk_adjustment_set_value (adjustment, value); -} - -static double -gtk_spin_button_accessible_get_increment (AtkValue *obj) -{ - GtkWidget *widget; - GtkAdjustment *adjustment; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - if (adjustment == NULL) - return 0; - - return gtk_adjustment_get_minimum_increment (adjustment); -} - -static void -atk_value_interface_init (AtkValueIface *iface) -{ - iface->get_current_value = gtk_spin_button_accessible_get_current_value; - iface->get_maximum_value = gtk_spin_button_accessible_get_maximum_value; - iface->get_minimum_value = gtk_spin_button_accessible_get_minimum_value; - iface->get_minimum_increment = gtk_spin_button_accessible_get_minimum_increment; - iface->set_current_value = gtk_spin_button_accessible_set_current_value; - - iface->get_value_and_text = gtk_spin_button_accessible_get_value_and_text; - iface->get_range = gtk_spin_button_accessible_get_range; - iface->set_value = gtk_spin_button_accessible_set_value; - iface->get_increment = gtk_spin_button_accessible_get_increment; -} diff --git a/gtk/a11y/gtkspinbuttonaccessible.h b/gtk/a11y/gtkspinbuttonaccessible.h deleted file mode 100644 index 8a2e597669..0000000000 --- a/gtk/a11y/gtkspinbuttonaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_SPIN_BUTTON_ACCESSIBLE_H__ -#define __GTK_SPIN_BUTTON_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkentryaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_SPIN_BUTTON_ACCESSIBLE (gtk_spin_button_accessible_get_type ()) -#define GTK_SPIN_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SPIN_BUTTON_ACCESSIBLE, GtkSpinButtonAccessible)) -#define GTK_SPIN_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SPIN_BUTTON_ACCESSIBLE, GtkSpinButtonAccessibleClass)) -#define GTK_IS_SPIN_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SPIN_BUTTON_ACCESSIBLE)) -#define GTK_IS_SPIN_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SPIN_BUTTON_ACCESSIBLE)) -#define GTK_SPIN_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SPIN_BUTTON_ACCESSIBLE, GtkSpinButtonAccessibleClass)) - -typedef struct _GtkSpinButtonAccessible GtkSpinButtonAccessible; -typedef struct _GtkSpinButtonAccessibleClass GtkSpinButtonAccessibleClass; -typedef struct _GtkSpinButtonAccessiblePrivate GtkSpinButtonAccessiblePrivate; - -struct _GtkSpinButtonAccessible -{ - GtkEntryAccessible parent; - - GtkSpinButtonAccessiblePrivate *priv; -}; - -struct _GtkSpinButtonAccessibleClass -{ - GtkEntryAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_spin_button_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_SPIN_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkspinneraccessible.c b/gtk/a11y/gtkspinneraccessible.c deleted file mode 100644 index cb055db7ad..0000000000 --- a/gtk/a11y/gtkspinneraccessible.c +++ /dev/null @@ -1,80 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2007 John Stowers, Neil Jagdish Patel. - * Copyright (C) 2009 Bastien Nocera, David Zeuthen - * - * 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 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/>. - * - * Code adapted from egg-spinner - * by Christian Hergert <christian.hergert@gmail.com> - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "gtkintl.h" -#include "gtkspinneraccessible.h" - -static void atk_image_interface_init (AtkImageIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkSpinnerAccessible, gtk_spinner_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init)); - -static void -gtk_spinner_accessible_initialize (AtkObject *accessible, - gpointer widget) -{ - ATK_OBJECT_CLASS (gtk_spinner_accessible_parent_class)->initialize (accessible, widget); - - atk_object_set_name (accessible, C_("throbbing progress animation widget", "Spinner")); - atk_object_set_description (accessible, _("Provides visual indication of progress")); - atk_object_set_role (accessible, ATK_ROLE_ANIMATION); -} - -static void -gtk_spinner_accessible_class_init (GtkSpinnerAccessibleClass *klass) -{ - AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); - - atk_class->initialize = gtk_spinner_accessible_initialize; -} - -static void -gtk_spinner_accessible_init (GtkSpinnerAccessible *self) -{ -} - -static void -gtk_spinner_accessible_image_get_size (AtkImage *image, - int *width, - int *height) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image)); - if (widget == NULL) - { - *width = 0; - *height = 0; - return; - } - - *width = gtk_widget_get_width (widget); - *height = gtk_widget_get_height (widget); -} - -static void -atk_image_interface_init (AtkImageIface *iface) -{ - iface->get_image_size = gtk_spinner_accessible_image_get_size; -} diff --git a/gtk/a11y/gtkspinneraccessible.h b/gtk/a11y/gtkspinneraccessible.h deleted file mode 100644 index 5258db6f5b..0000000000 --- a/gtk/a11y/gtkspinneraccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2011 Red Hat, Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_SPINNER_ACCESSIBLE_H__ -#define __GTK_SPINNER_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_SPINNER_ACCESSIBLE (gtk_spinner_accessible_get_type ()) -#define GTK_SPINNER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SPINNER_ACCESSIBLE, GtkSpinnerAccessible)) -#define GTK_SPINNER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SPINNER_ACCESSIBLE, GtkSpinnerAccessibleClass)) -#define GTK_IS_SPINNER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SPINNER_ACCESSIBLE)) -#define GTK_IS_SPINNER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SPINNER_ACCESSIBLE)) -#define GTK_SPINNER_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SPINNER_ACCESSIBLE, GtkSpinnerAccessibleClass)) - -typedef struct _GtkSpinnerAccessible GtkSpinnerAccessible; -typedef struct _GtkSpinnerAccessibleClass GtkSpinnerAccessibleClass; -typedef struct _GtkSpinnerAccessiblePrivate GtkSpinnerAccessiblePrivate; - -struct _GtkSpinnerAccessible -{ - GtkWidgetAccessible parent; - - GtkSpinnerAccessiblePrivate *priv; -}; - -struct _GtkSpinnerAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_spinner_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_SPINNER_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkstackaccessible.c b/gtk/a11y/gtkstackaccessible.c deleted file mode 100644 index 23b4e13762..0000000000 --- a/gtk/a11y/gtkstackaccessible.c +++ /dev/null @@ -1,102 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2016 Timm Bäder <mail@baedert.org> - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtkstackaccessibleprivate.h" -#include "gtkwidgetprivate.h" - - -G_DEFINE_TYPE (GtkStackAccessible, gtk_stack_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static AtkObject* -gtk_stack_accessible_ref_child (AtkObject *obj, - int i) -{ - GtkWidget *stack = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - GtkWidget *visible_child; - - if (stack == NULL) - return NULL; - - if (i != 0) - return NULL; - - visible_child = gtk_stack_get_visible_child (GTK_STACK (stack)); - - if (visible_child == NULL) - return NULL; - - return g_object_ref (gtk_widget_get_accessible (visible_child)); -} - -static int -gtk_stack_accessible_get_n_children (AtkObject *obj) -{ - GtkWidget *stack = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - - if (stack == NULL) - return 0; - - if (gtk_stack_get_visible_child (GTK_STACK (stack))) - return 1; - - return 0; -} - -static void -gtk_stack_accessible_class_init (GtkStackAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_n_children = gtk_stack_accessible_get_n_children; - class->ref_child = gtk_stack_accessible_ref_child; -} - -static void -gtk_stack_accessible_init (GtkStackAccessible *bar) {} - - -void -gtk_stack_accessible_update_visible_child (GtkStack *stack, - GtkWidget *old_visible_child, - GtkWidget *new_visible_child) -{ - AtkObject *stack_accessible = _gtk_widget_peek_accessible (GTK_WIDGET (stack)); - - if (stack_accessible == NULL) - return; - - if (old_visible_child) - { - AtkObject *accessible = gtk_widget_get_accessible (old_visible_child); - g_object_notify (G_OBJECT (accessible), "accessible-parent"); - g_signal_emit_by_name (stack_accessible, "children-changed::remove", 0, accessible, NULL); - } - - if (new_visible_child) - { - AtkObject *accessible = gtk_widget_get_accessible (new_visible_child); - g_object_notify (G_OBJECT (accessible), "accessible-parent"); - g_signal_emit_by_name (stack_accessible, "children-changed::add", 0, accessible, NULL); - } -} - - - diff --git a/gtk/a11y/gtkstackaccessible.h b/gtk/a11y/gtkstackaccessible.h deleted file mode 100644 index 6254c33802..0000000000 --- a/gtk/a11y/gtkstackaccessible.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2016 Timm Bäder <mail@baedert.org> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_STACK_ACCESSIBLE_H__ -#define __GTK_STACK_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_STACK_ACCESSIBLE (gtk_stack_accessible_get_type ()) -#define GTK_STACK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_STACK_ACCESSIBLE, GtkStackAccessible)) -#define GTK_STACK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STACK_ACCESSIBLE, GtkStackAccessibleClass)) -#define GTK_IS_STACK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_STACK_ACCESSIBLE)) -#define GTK_IS_STACK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STACK_ACCESSIBLE)) -#define GTK_STACK_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STACK_ACCESSIBLE, GtkStackAccessibleClass)) - -typedef struct _GtkStackAccessible GtkStackAccessible; -typedef struct _GtkStackAccessibleClass GtkStackAccessibleClass; - -struct _GtkStackAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkStackAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_stack_accessible_get_type (void); - -G_END_DECLS - -#endif diff --git a/gtk/a11y/gtkstackaccessibleprivate.h b/gtk/a11y/gtkstackaccessibleprivate.h deleted file mode 100644 index c69a48d780..0000000000 --- a/gtk/a11y/gtkstackaccessibleprivate.h +++ /dev/null @@ -1,32 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2016 Timm Bäder <mail@baedert.org> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_STACK_ACCESSIBLE_PRIVATE_H__ -#define __GTK_STACK_ACCESSIBLE_PRIVATE_H__ - -#include "gtkstackaccessible.h" - -G_BEGIN_DECLS - -void gtk_stack_accessible_update_visible_child (GtkStack *stack, - GtkWidget *old_visible_child, - GtkWidget *new_visible_child); - - -G_END_DECLS - -#endif /* __GTK_STACK_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtkstatusbaraccessible.c b/gtk/a11y/gtkstatusbaraccessible.c deleted file mode 100644 index b2be32a9b0..0000000000 --- a/gtk/a11y/gtkstatusbaraccessible.c +++ /dev/null @@ -1,99 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtkstatusbarprivate.h" -#include "gtkstatusbaraccessible.h" - - -G_DEFINE_TYPE (GtkStatusbarAccessible, gtk_statusbar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE) - -static void -text_changed (GtkStatusbar *statusbar, - guint context_id, - const char *text, - AtkObject *obj) -{ - if (!obj->name) - g_object_notify (G_OBJECT (obj), "accessible-name"); - g_signal_emit_by_name (obj, "visible-data-changed"); -} - -static void -gtk_statusbar_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkWidget *statusbar = data; - - ATK_OBJECT_CLASS (gtk_statusbar_accessible_parent_class)->initialize (obj, data); - - g_signal_connect_after (statusbar, "text-pushed", - G_CALLBACK (text_changed), obj); - g_signal_connect_after (statusbar, "text-popped", - G_CALLBACK (text_changed), obj); - - obj->role = ATK_ROLE_STATUSBAR; -} - -static const char * -gtk_statusbar_accessible_get_name (AtkObject *obj) -{ - const char *name; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - name = ATK_OBJECT_CLASS (gtk_statusbar_accessible_parent_class)->get_name (obj); - if (name != NULL) - return name; - - return gtk_statusbar_get_message (GTK_STATUSBAR (widget)); -} - -static int -gtk_statusbar_accessible_get_n_children (AtkObject *obj) -{ - return 0; -} - -static AtkObject* -gtk_statusbar_accessible_ref_child (AtkObject *obj, - int i) -{ - return NULL; -} - -static void -gtk_statusbar_accessible_class_init (GtkStatusbarAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_name = gtk_statusbar_accessible_get_name; - class->get_n_children = gtk_statusbar_accessible_get_n_children; - class->ref_child = gtk_statusbar_accessible_ref_child; - class->initialize = gtk_statusbar_accessible_initialize; -} - -static void -gtk_statusbar_accessible_init (GtkStatusbarAccessible *bar) -{ -} diff --git a/gtk/a11y/gtkstatusbaraccessible.h b/gtk/a11y/gtkstatusbaraccessible.h deleted file mode 100644 index 8a25f8dbd0..0000000000 --- a/gtk/a11y/gtkstatusbaraccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_STATUSBAR_ACCESSIBLE_H__ -#define __GTK_STATUSBAR_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_STATUSBAR_ACCESSIBLE (gtk_statusbar_accessible_get_type ()) -#define GTK_STATUSBAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_STATUSBAR_ACCESSIBLE, GtkStatusbarAccessible)) -#define GTK_STATUSBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STATUSBAR_ACCESSIBLE, GtkStatusbarAccessibleClass)) -#define GTK_IS_STATUSBAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_STATUSBAR_ACCESSIBLE)) -#define GTK_IS_STATUSBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STATUSBAR_ACCESSIBLE)) -#define GTK_STATUSBAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STATUSBAR_ACCESSIBLE, GtkStatusbarAccessibleClass)) - -typedef struct _GtkStatusbarAccessible GtkStatusbarAccessible; -typedef struct _GtkStatusbarAccessibleClass GtkStatusbarAccessibleClass; -typedef struct _GtkStatusbarAccessiblePrivate GtkStatusbarAccessiblePrivate; - -struct _GtkStatusbarAccessible -{ - GtkWidgetAccessible parent; - - GtkStatusbarAccessiblePrivate *priv; -}; - -struct _GtkStatusbarAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_statusbar_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_STATUSBAR_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkswitchaccessible.c b/gtk/a11y/gtkswitchaccessible.c deleted file mode 100644 index 1b63ee4806..0000000000 --- a/gtk/a11y/gtkswitchaccessible.c +++ /dev/null @@ -1,133 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2010 Intel Corporation - * Copyright (C) 2010 RedHat, Inc. - * - * 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 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/>. - * - * Author: - * Emmanuele Bassi <ebassi@linux.intel.com> - * Matthias Clasen <mclasen@redhat.com> - * - * Based on similar code from Mx. - */ - -#include "config.h" - -#include <glib/gi18n-lib.h> -#include <gtk/gtk.h> -#include "gtkintl.h" -#include "gtkswitchaccessible.h" - - -static void atk_action_interface_init (AtkActionIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkSwitchAccessible, gtk_switch_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - -static AtkStateSet * -gtk_switch_accessible_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - state_set = ATK_OBJECT_CLASS (gtk_switch_accessible_parent_class)->ref_state_set (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return state_set; - - if (gtk_switch_get_active (GTK_SWITCH (widget))) - atk_state_set_add_state (state_set, ATK_STATE_CHECKED); - - return state_set; -} - -static void -gtk_switch_accessible_class_init (GtkSwitchAccessibleClass *klass) -{ - AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); - - atk_class->ref_state_set = gtk_switch_accessible_ref_state_set; -} - -static void -gtk_switch_accessible_init (GtkSwitchAccessible *self) -{ -} - -static int -gtk_switch_action_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_switch_action_get_name (AtkAction *action, - int i) -{ - if (i == 0) - return "toggle"; - return NULL; -} - -static const char * -gtk_switch_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Toggle"); - return NULL; -} - -static const char * -gtk_switch_action_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Toggles the switch"); - return NULL; -} - -static gboolean -gtk_switch_action_do_action (AtkAction *action, - int i) -{ - GtkSwitch *sw; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (i != 0) - return FALSE; - - if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - sw = GTK_SWITCH (widget); - gtk_switch_set_active (sw, !gtk_switch_get_active (sw)); - - return TRUE; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_switch_action_do_action; - iface->get_n_actions = gtk_switch_action_get_n_actions; - iface->get_name = gtk_switch_action_get_name; - iface->get_localized_name = gtk_switch_action_get_localized_name; - iface->get_description = gtk_switch_action_get_description; -} diff --git a/gtk/a11y/gtkswitchaccessible.h b/gtk/a11y/gtkswitchaccessible.h deleted file mode 100644 index 1e2039e58d..0000000000 --- a/gtk/a11y/gtkswitchaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2011 Red Hat, Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_SWITCH_ACCESSIBLE_H__ -#define __GTK_SWITCH_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_SWITCH_ACCESSIBLE (gtk_switch_accessible_get_type ()) -#define GTK_SWITCH_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SWITCH_ACCESSIBLE, GtkSwitchAccessible)) -#define GTK_SWITCH_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SWITCH_ACCESSIBLE, GtkSwitchAccessibleClass)) -#define GTK_IS_SWITCH_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SWITCH_ACCESSIBLE)) -#define GTK_IS_SWITCH_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SWITCH_ACCESSIBLE)) -#define GTK_SWITCH_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SWITCH_ACCESSIBLE, GtkSwitchAccessibleClass)) - -typedef struct _GtkSwitchAccessible GtkSwitchAccessible; -typedef struct _GtkSwitchAccessibleClass GtkSwitchAccessibleClass; -typedef struct _GtkSwitchAccessiblePrivate GtkSwitchAccessiblePrivate; - -struct _GtkSwitchAccessible -{ - GtkWidgetAccessible parent; - - GtkSwitchAccessiblePrivate *priv; -}; - -struct _GtkSwitchAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_switch_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_SWITCH_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtktextaccessible.c b/gtk/a11y/gtktextaccessible.c deleted file mode 100644 index 66f110aa46..0000000000 --- a/gtk/a11y/gtktextaccessible.c +++ /dev/null @@ -1,1016 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gdk/gdkeventsprivate.h" - -#include <glib/gi18n-lib.h> -#include <string.h> -#include <gtk/gtk.h> -#include "gtkpango.h" -#include "gtktextaccessible.h" -#include "gtktextprivate.h" -#include "gtkcomboboxaccessible.h" -#include "gtkstylecontextprivate.h" -#include "gtkwidgetprivate.h" - -struct _GtkTextAccessiblePrivate -{ - int cursor_position; - int selection_bound; -}; - -/* Callbacks */ - -static void insert_text_cb (GtkEditable *editable, - char *new_text, - int new_text_length, - int *position); -static void delete_text_cb (GtkEditable *editable, - int start, - int end); - -static gboolean check_for_selection_change (GtkTextAccessible *entry, - GtkText *gtk_text); - - -static void atk_editable_text_interface_init (AtkEditableTextIface *iface); -static void atk_text_interface_init (AtkTextIface *iface); -static void atk_action_interface_init (AtkActionIface *iface); - - -G_DEFINE_TYPE_WITH_CODE (GtkTextAccessible, gtk_text_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkTextAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)) - - -static AtkStateSet * -gtk_text_accessible_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - gboolean value; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - state_set = ATK_OBJECT_CLASS (gtk_text_accessible_parent_class)->ref_state_set (accessible); - - g_object_get (G_OBJECT (widget), "editable", &value, NULL); - if (value) - atk_state_set_add_state (state_set, ATK_STATE_EDITABLE); - atk_state_set_add_state (state_set, ATK_STATE_SINGLE_LINE); - - return state_set; -} - -static AtkAttributeSet * -gtk_text_accessible_get_attributes (AtkObject *accessible) -{ - GtkWidget *widget; - AtkAttributeSet *attributes; - AtkAttribute *placeholder_text; - const char *text; - - attributes = ATK_OBJECT_CLASS (gtk_text_accessible_parent_class)->get_attributes (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return attributes; - - text = gtk_text_get_placeholder_text (GTK_TEXT (widget)); - if (text == NULL) - return attributes; - - placeholder_text = g_malloc (sizeof (AtkAttribute)); - placeholder_text->name = g_strdup ("placeholder-text"); - placeholder_text->value = g_strdup (text); - - attributes = g_slist_append (attributes, placeholder_text); - - return attributes; -} - -static void -on_cursor_position_changed (GObject *gobject, - GParamSpec *pspec, - AtkObject *accessible) -{ - GtkTextAccessible *self = GTK_TEXT_ACCESSIBLE (accessible); - GtkTextAccessiblePrivate *priv = gtk_text_accessible_get_instance_private (self); - GtkText *text = GTK_TEXT (gobject); - - if (check_for_selection_change (self, text)) - g_signal_emit_by_name (accessible, "text-selection-changed"); - - /* The entry cursor position has moved so generate the signal */ - g_signal_emit_by_name (accessible, - "text-caret-moved", - priv->cursor_position); -} - -static void -on_selection_bound_changed (GObject *gobject, - GParamSpec *pspec, - AtkObject *accessible) -{ - GtkTextAccessible *self = GTK_TEXT_ACCESSIBLE (accessible); - GtkText *text = GTK_TEXT (gobject); - - if (check_for_selection_change (self, text)) - g_signal_emit_by_name (accessible, "text-selection-changed"); -} - -static void -on_editable_changed (GObject *gobject, - GParamSpec *pspec, - AtkObject *accessible) -{ - GtkEditable *editable = GTK_EDITABLE (gobject); - gboolean value = gtk_editable_get_editable (editable); - - atk_object_notify_state_change (accessible, ATK_STATE_EDITABLE, value); -} - -static void -on_visibility_changed (GObject *gobject, - GParamSpec *pspec, - AtkObject *accessible) -{ - GtkText *text = GTK_TEXT (gobject); - AtkRole new_role; - - new_role = gtk_text_get_visibility (text) - ? ATK_ROLE_TEXT - : ATK_ROLE_PASSWORD_TEXT; - - atk_object_set_role (accessible, new_role); -} - -static void -gtk_text_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkText *entry; - GtkTextAccessible *gtk_text_accessible; - int start_pos, end_pos; - - ATK_OBJECT_CLASS (gtk_text_accessible_parent_class)->initialize (obj, data); - - gtk_text_accessible = GTK_TEXT_ACCESSIBLE (obj); - - entry = GTK_TEXT (data); - gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos); - gtk_text_accessible->priv->cursor_position = end_pos; - gtk_text_accessible->priv->selection_bound = start_pos; - - /* Set up signal callbacks */ - g_signal_connect_after (entry, "insert-text", G_CALLBACK (insert_text_cb), NULL); - g_signal_connect (entry, "delete-text", G_CALLBACK (delete_text_cb), NULL); - - g_signal_connect (entry, "notify::cursor-position", G_CALLBACK (on_cursor_position_changed), obj); - g_signal_connect (entry, "notify::selection-bound", G_CALLBACK (on_selection_bound_changed), obj); - g_signal_connect (entry, "notify::editable", G_CALLBACK (on_editable_changed), obj); - g_signal_connect (entry, "notify::visibility", G_CALLBACK (on_visibility_changed), obj); - - if (gtk_text_get_visibility (entry)) - obj->role = ATK_ROLE_TEXT; - else - obj->role = ATK_ROLE_PASSWORD_TEXT; -} - -static int -gtk_text_accessible_get_index_in_parent (AtkObject *accessible) -{ - /* If the parent widget is a combo box then the index is 1 - * otherwise do the normal thing. - */ - if (accessible->accessible_parent) - if (GTK_IS_COMBO_BOX_ACCESSIBLE (accessible->accessible_parent)) - return 1; - - return ATK_OBJECT_CLASS (gtk_text_accessible_parent_class)->get_index_in_parent (accessible); -} - -static void -gtk_text_accessible_class_init (GtkTextAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->ref_state_set = gtk_text_accessible_ref_state_set; - class->get_index_in_parent = gtk_text_accessible_get_index_in_parent; - class->initialize = gtk_text_accessible_initialize; - class->get_attributes = gtk_text_accessible_get_attributes; -} - -static void -gtk_text_accessible_init (GtkTextAccessible *entry) -{ - entry->priv = gtk_text_accessible_get_instance_private (entry); - entry->priv->cursor_position = 0; - entry->priv->selection_bound = 0; -} - -static char * -gtk_text_accessible_get_text (AtkText *atk_text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return NULL; - - return gtk_text_get_display_text (GTK_TEXT (widget), start_pos, end_pos); -} - -static char * -gtk_text_accessible_get_text_before_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - return _gtk_pango_get_text_before (gtk_text_get_layout (GTK_TEXT (widget)), - boundary_type, offset, - start_offset, end_offset); -} - -static char * -gtk_text_accessible_get_text_at_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - return _gtk_pango_get_text_at (gtk_text_get_layout (GTK_TEXT (widget)), - boundary_type, offset, - start_offset, end_offset); -} - -static char * -gtk_text_accessible_get_text_after_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - return _gtk_pango_get_text_after (gtk_text_get_layout (GTK_TEXT (widget)), - boundary_type, offset, - start_offset, end_offset); -} - -static int -gtk_text_accessible_get_character_count (AtkText *atk_text) -{ - GtkWidget *widget; - char *text; - glong char_count; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return 0; - - text = gtk_text_get_display_text (GTK_TEXT (widget), 0, -1); - - char_count = 0; - if (text) - { - char_count = g_utf8_strlen (text, -1); - g_free (text); - } - - return char_count; -} - -static int -gtk_text_accessible_get_caret_offset (AtkText *text) -{ - GtkWidget *widget; - gboolean result; - int cursor_position; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return -1; - - result = gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), NULL, &cursor_position); - if (!result) - return -1; - - return cursor_position; -} - -static gboolean -gtk_text_accessible_set_caret_offset (AtkText *text, - int offset) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - gtk_editable_set_position (GTK_EDITABLE (widget), offset); - - return TRUE; -} - -static AtkAttributeSet * -add_text_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - int i) -{ - AtkAttribute *at; - - at = g_new (AtkAttribute, 1); - at->name = g_strdup (atk_text_attribute_get_name (attr)); - at->value = g_strdup (atk_text_attribute_get_value (attr, i)); - - return g_slist_prepend (attributes, at); -} - -static AtkAttributeSet * -gtk_text_accessible_get_run_attributes (AtkText *text, - int offset, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - AtkAttributeSet *attributes; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - attributes = NULL; - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (widget)); - attributes = _gtk_pango_get_run_attributes (attributes, - gtk_text_get_layout (GTK_TEXT (widget)), - offset, - start_offset, - end_offset); - - return attributes; -} - -static AtkAttributeSet * -gtk_text_accessible_get_default_attributes (AtkText *text) -{ - GtkWidget *widget; - AtkAttributeSet *attributes; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - attributes = NULL; - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (widget)); - attributes = _gtk_pango_get_default_attributes (attributes, - gtk_text_get_layout (GTK_TEXT (widget))); - attributes = _gtk_style_context_get_attributes (attributes, - gtk_widget_get_style_context (widget)); - - return attributes; -} - -static void -gtk_text_accessible_get_character_extents (AtkText *text, - int offset, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coords) -{ - GtkWidget *widget; - GtkText *entry; - PangoRectangle char_rect; - char *entry_text; - int index, x_layout, y_layout; - GtkAllocation allocation; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - entry = GTK_TEXT (widget); - - gtk_text_get_layout_offsets (entry, &x_layout, &y_layout); - entry_text = gtk_text_get_display_text (entry, 0, -1); - index = g_utf8_offset_to_pointer (entry_text, offset) - entry_text; - g_free (entry_text); - - pango_layout_index_to_pos (gtk_text_get_layout (entry), index, &char_rect); - pango_extents_to_pixels (&char_rect, NULL); - - gtk_widget_get_allocation (widget, &allocation); - - *x = allocation.x + x_layout + char_rect.x; - *y = allocation.y + y_layout + char_rect.y; - *width = char_rect.width; - *height = char_rect.height; -} - -static int -gtk_text_accessible_get_offset_at_point (AtkText *atk_text, - int x, - int y, - AtkCoordType coords) -{ - GtkWidget *widget; - GtkText *entry; - char *text; - int index, x_layout, y_layout; - int x_local, y_local; - glong offset; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return -1; - - entry = GTK_TEXT (widget); - - gtk_text_get_layout_offsets (entry, &x_layout, &y_layout); - - x_local = x - x_layout; - y_local = y - y_layout; - - if (!pango_layout_xy_to_index (gtk_text_get_layout (entry), - x_local * PANGO_SCALE, - y_local * PANGO_SCALE, - &index, NULL)) - { - if (x_local < 0 || y_local < 0) - index = 0; - else - index = -1; - } - - offset = -1; - if (index != -1) - { - text = gtk_text_get_display_text (entry, 0, -1); - offset = g_utf8_pointer_to_offset (text, text + index); - g_free (text); - } - - return offset; -} - -static int -gtk_text_accessible_get_n_selections (AtkText *text) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return 0; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - return 1; - - return 0; -} - -static char * -gtk_text_accessible_get_selection (AtkText *text, - int selection_num, - int *start_pos, - int *end_pos) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - if (selection_num != 0) - return NULL; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), start_pos, end_pos)) - return gtk_editable_get_chars (GTK_EDITABLE (widget), *start_pos, *end_pos); - - return NULL; -} - -static gboolean -gtk_text_accessible_add_selection (AtkText *text, - int start_pos, - int end_pos) -{ - GtkText *entry; - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - entry = GTK_TEXT (widget); - - if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (entry), start_pos, end_pos); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_text_accessible_remove_selection (AtkText *text, - int selection_num) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (widget), end, end); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_text_accessible_set_selection (AtkText *text, - int selection_num, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - int start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start, &end)) - { - gtk_editable_select_region (GTK_EDITABLE (widget), start_pos, end_pos); - return TRUE; - } - else - return FALSE; -} - -static gunichar -gtk_text_accessible_get_character_at_offset (AtkText *atk_text, - int offset) -{ - GtkWidget *widget; - char *text; - char *index; - gunichar result; - - result = '\0'; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return result; - - if (!gtk_text_get_visibility (GTK_TEXT (widget))) - return result; - - text = gtk_text_get_display_text (GTK_TEXT (widget), 0, -1); - if (offset < g_utf8_strlen (text, -1)) - { - index = g_utf8_offset_to_pointer (text, offset); - result = g_utf8_get_char (index); - g_free (text); - } - - return result; -} - -static void -atk_text_interface_init (AtkTextIface *iface) -{ - iface->get_text = gtk_text_accessible_get_text; - iface->get_character_at_offset = gtk_text_accessible_get_character_at_offset; - iface->get_text_before_offset = gtk_text_accessible_get_text_before_offset; - iface->get_text_at_offset = gtk_text_accessible_get_text_at_offset; - iface->get_text_after_offset = gtk_text_accessible_get_text_after_offset; - iface->get_caret_offset = gtk_text_accessible_get_caret_offset; - iface->set_caret_offset = gtk_text_accessible_set_caret_offset; - iface->get_character_count = gtk_text_accessible_get_character_count; - iface->get_n_selections = gtk_text_accessible_get_n_selections; - iface->get_selection = gtk_text_accessible_get_selection; - iface->add_selection = gtk_text_accessible_add_selection; - iface->remove_selection = gtk_text_accessible_remove_selection; - iface->set_selection = gtk_text_accessible_set_selection; - iface->get_run_attributes = gtk_text_accessible_get_run_attributes; - iface->get_default_attributes = gtk_text_accessible_get_default_attributes; - iface->get_character_extents = gtk_text_accessible_get_character_extents; - iface->get_offset_at_point = gtk_text_accessible_get_offset_at_point; -} - -static void -gtk_text_accessible_set_text_contents (AtkEditableText *text, - const char *string) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - if (!gtk_editable_get_editable (GTK_EDITABLE (widget))) - return; - - gtk_editable_set_text (GTK_EDITABLE (widget), string); -} - -static void -gtk_text_accessible_insert_text (AtkEditableText *text, - const char *string, - int length, - int *position) -{ - GtkWidget *widget; - GtkEditable *editable; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - gtk_editable_insert_text (editable, string, length, position); - gtk_editable_set_position (editable, *position); -} - -static void -gtk_text_accessible_copy_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - char *str; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - str = gtk_editable_get_chars (editable, start_pos, end_pos); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_set_text (clipboard, str); - g_free (str); -} - -static void -gtk_text_accessible_cut_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - char *str; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - str = gtk_editable_get_chars (editable, start_pos, end_pos); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_set_text (clipboard, str); - gtk_editable_delete_text (editable, start_pos, end_pos); -} - -static void -gtk_text_accessible_delete_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkEditable *editable; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - gtk_editable_delete_text (editable, start_pos, end_pos); -} - -typedef struct -{ - GtkText* entry; - int position; -} PasteData; - -static void -paste_received_cb (GObject *clipboard, - GAsyncResult *result, - gpointer data) -{ - PasteData *paste = data; - char *text; - - text = gdk_clipboard_read_text_finish (GDK_CLIPBOARD (clipboard), result, NULL); - if (text) - gtk_editable_insert_text (GTK_EDITABLE (paste->entry), text, -1, - &paste->position); - - g_object_unref (paste->entry); - g_free (paste); - g_free (text); -} - -static void -gtk_text_accessible_paste_text (AtkEditableText *text, - int position) -{ - GtkWidget *widget; - GtkEditable *editable; - PasteData *paste; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - editable = GTK_EDITABLE (widget); - if (!gtk_editable_get_editable (editable)) - return; - - paste = g_new0 (PasteData, 1); - paste->entry = GTK_TEXT (widget); - paste->position = position; - - g_object_ref (paste->entry); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_read_text_async (clipboard, NULL, paste_received_cb, paste); -} - -static void -atk_editable_text_interface_init (AtkEditableTextIface *iface) -{ - iface->set_text_contents = gtk_text_accessible_set_text_contents; - iface->insert_text = gtk_text_accessible_insert_text; - iface->copy_text = gtk_text_accessible_copy_text; - iface->cut_text = gtk_text_accessible_cut_text; - iface->delete_text = gtk_text_accessible_delete_text; - iface->paste_text = gtk_text_accessible_paste_text; - iface->set_run_attributes = NULL; -} - -static void -insert_text_cb (GtkEditable *editable, - char *new_text, - int new_text_length, - int *position) -{ - GtkTextAccessible *accessible; - int length; - - if (new_text_length == 0) - return; - - accessible = GTK_TEXT_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (editable))); - length = g_utf8_strlen (new_text, new_text_length); - - g_signal_emit_by_name (accessible, - "text-changed::insert", - *position - length, - length); -} - -/* We connect to GtkEditable::delete-text, since it carries - * the information we need. But we delay emitting our own - * text_changed::delete signal until the entry has update - * all its internal state and emits GtkText::changed. - */ -static void -delete_text_cb (GtkEditable *editable, - int start, - int end) -{ - GtkTextAccessible *accessible; - - accessible = GTK_TEXT_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (editable))); - - if (end < 0) - { - char *text; - - text = gtk_text_get_display_text (GTK_TEXT (editable), 0, -1); - end = g_utf8_strlen (text, -1); - g_free (text); - } - - if (end == start) - return; - - g_signal_emit_by_name (accessible, - "text-changed::delete", - start, - end - start); -} - -static gboolean -check_for_selection_change (GtkTextAccessible *accessible, - GtkText *entry) -{ - gboolean ret_val = FALSE; - int start, end; - - if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start, &end)) - { - if (end != accessible->priv->cursor_position || - start != accessible->priv->selection_bound) - /* - * This check is here as this function can be called - * for notification of selection_bound and current_pos. - * The values of current_pos and selection_bound may be the same - * for both notifications and we only want to generate one - * text_selection_changed signal. - */ - ret_val = TRUE; - } - else - { - /* We had a selection */ - ret_val = (accessible->priv->cursor_position != accessible->priv->selection_bound); - } - - accessible->priv->cursor_position = end; - accessible->priv->selection_bound = start; - - return ret_val; -} - -static gboolean -gtk_text_accessible_do_action (AtkAction *action, - int i) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return FALSE; - - if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget)) - return FALSE; - - if (i != 0) - return FALSE; - - gtk_widget_activate (widget); - - return TRUE; -} - -static int -gtk_text_accessible_get_n_actions (AtkAction *action) -{ - return 1; -} - -static const char * -gtk_text_accessible_get_keybinding (AtkAction *action, - int i) -{ - GtkWidget *widget; - GtkWidget *label; - AtkRelationSet *set; - AtkRelation *relation; - GPtrArray *target; - gpointer target_object; - guint key_val; - - if (i != 0) - return NULL; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action)); - if (widget == NULL) - return NULL; - - set = atk_object_ref_relation_set (ATK_OBJECT (action)); - if (!set) - return NULL; - - label = NULL; - relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY); - if (relation) - { - target = atk_relation_get_target (relation); - - target_object = g_ptr_array_index (target, 0); - label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object)); - } - - g_object_unref (set); - - if (GTK_IS_LABEL (label)) - { - key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label)); - if (key_val != GDK_KEY_VoidSymbol) - return gtk_accelerator_name (key_val, GDK_ALT_MASK); - } - - return NULL; -} - -static const char * -gtk_text_accessible_action_get_name (AtkAction *action, - int i) -{ - if (i == 0) - return "activate"; - return NULL; -} - -static const char * -gtk_text_accessible_action_get_localized_name (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action name", "Activate"); - return NULL; -} - -static const char * -gtk_text_accessible_action_get_description (AtkAction *action, - int i) -{ - if (i == 0) - return C_("Action description", "Activates the entry"); - return NULL; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - iface->do_action = gtk_text_accessible_do_action; - iface->get_n_actions = gtk_text_accessible_get_n_actions; - iface->get_keybinding = gtk_text_accessible_get_keybinding; - iface->get_name = gtk_text_accessible_action_get_name; - iface->get_localized_name = gtk_text_accessible_action_get_localized_name; - iface->get_description = gtk_text_accessible_action_get_description; -} diff --git a/gtk/a11y/gtktextaccessible.h b/gtk/a11y/gtktextaccessible.h deleted file mode 100644 index e47be4236d..0000000000 --- a/gtk/a11y/gtktextaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_TEXT_ACCESSIBLE_H__ -#define __GTK_TEXT_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_TEXT_ACCESSIBLE (gtk_text_accessible_get_type ()) -#define GTK_TEXT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_ACCESSIBLE, GtkTextAccessible)) -#define GTK_TEXT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_ACCESSIBLE, GtkTextAccessibleClass)) -#define GTK_IS_TEXT_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_ACCESSIBLE)) -#define GTK_IS_TEXT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_ACCESSIBLE)) -#define GTK_TEXT_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_ACCESSIBLE, GtkTextAccessibleClass)) - -typedef struct _GtkTextAccessible GtkTextAccessible; -typedef struct _GtkTextAccessibleClass GtkTextAccessibleClass; -typedef struct _GtkTextAccessiblePrivate GtkTextAccessiblePrivate; - -struct _GtkTextAccessible -{ - GtkWidgetAccessible parent; - - GtkTextAccessiblePrivate *priv; -}; - -struct _GtkTextAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_text_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_TEXT_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtktextcellaccessible.c b/gtk/a11y/gtktextcellaccessible.c deleted file mode 100644 index 7af56d9696..0000000000 --- a/gtk/a11y/gtktextcellaccessible.c +++ /dev/null @@ -1,701 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include "../gtkpango.h" -#include "gtktextcellaccessible.h" -#include "gtkcontainercellaccessible.h" -#include "gtkcellaccessibleparent.h" -#include "gtkstylecontextprivate.h" - -struct _GtkTextCellAccessiblePrivate -{ - char *cell_text; - int caret_pos; - int cell_length; - PangoLayout *layout; -}; - -static const char * gtk_text_cell_accessible_get_name (AtkObject *atk_obj); - - -/* atktext.h */ - -static char * gtk_text_cell_accessible_get_text (AtkText *text, - int start_pos, - int end_pos); -static gunichar gtk_text_cell_accessible_get_character_at_offset (AtkText *text, - int offset); -static char * gtk_text_cell_accessible_get_text_before_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset); -static char * gtk_text_cell_accessible_get_text_at_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset); -static char * gtk_text_cell_accessible_get_text_after_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset); -static int gtk_text_cell_accessible_get_character_count (AtkText *text); -static int gtk_text_cell_accessible_get_caret_offset (AtkText *text); -static gboolean gtk_text_cell_accessible_set_caret_offset (AtkText *text, - int offset); -static void gtk_text_cell_accessible_get_character_extents (AtkText *text, - int offset, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coords); -static int gtk_text_cell_accessible_get_offset_at_point (AtkText *text, - int x, - int y, - AtkCoordType coords); -static AtkAttributeSet* gtk_text_cell_accessible_get_run_attributes - (AtkText *text, - int offset, - int *start_offset, - int *end_offset); -static AtkAttributeSet* gtk_text_cell_accessible_get_default_attributes - (AtkText *text); - -static GtkWidget* get_widget (GtkTextCellAccessible *cell); -static PangoLayout* create_pango_layout (GtkTextCellAccessible *cell); -static void add_attr (PangoAttrList *attr_list, - PangoAttribute *attr); - -/* Misc */ - -static void gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell, - gboolean emit_signal); - -static void atk_text_interface_init (AtkTextIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkTextCellAccessible, gtk_text_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE, - G_ADD_PRIVATE (GtkTextCellAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init)) - -static AtkStateSet * -gtk_text_cell_accessible_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - - state_set = ATK_OBJECT_CLASS (gtk_text_cell_accessible_parent_class)->ref_state_set (accessible); - - atk_state_set_add_state (state_set, ATK_STATE_SINGLE_LINE); - - return state_set; -} - -static void -gtk_text_cell_accessible_finalize (GObject *object) -{ - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (object); - - g_free (text_cell->priv->cell_text); - - if (text_cell->priv->layout) - g_object_unref (text_cell->priv->layout); - - G_OBJECT_CLASS (gtk_text_cell_accessible_parent_class)->finalize (object); -} - -static const char * -gtk_text_cell_accessible_get_name (AtkObject *atk_obj) -{ - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (atk_obj); - - if (atk_obj->name) - return atk_obj->name; - - return text_cell->priv->cell_text; -} - -static void -gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell, - gboolean emit_signal) -{ - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (cell); - AtkObject *obj = ATK_OBJECT (cell); - int text_length; - char *text; - GtkCellRenderer *renderer; - - if (text_cell->priv->layout) - g_object_unref (text_cell->priv->layout); - text_cell->priv->layout = create_pango_layout (text_cell); - - g_object_get (cell, "renderer", &renderer, NULL); - g_object_get (renderer, "text", &text, NULL); - g_object_unref (renderer); - - if (text == NULL) - text = g_strdup (""); - text_length = g_utf8_strlen (text, -1); - - if (g_strcmp0 (text_cell->priv->cell_text, text) != 0) - { - if (text_cell->priv->cell_length && emit_signal) - { - g_signal_emit_by_name (cell, "text-changed::delete", - 0, text_cell->priv->cell_length); - } - - g_free (text_cell->priv->cell_text); - text_cell->priv->cell_text = g_strdup (text); - text_cell->priv->cell_length = text_length; - - if (text_length && emit_signal) - { - g_signal_emit_by_name (cell, "text-changed::insert", - 0, text_cell->priv->cell_length); - } - - if (obj->name == NULL && emit_signal) - g_object_notify (G_OBJECT (obj), "accessible-name"); - } - - g_free (text); -} - -static void -gtk_text_cell_accessible_class_init (GtkTextCellAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - GtkCellAccessibleClass *cell_class = GTK_CELL_ACCESSIBLE_CLASS (klass); - - cell_class->update_cache = gtk_text_cell_accessible_update_cache; - - atk_object_class->get_name = gtk_text_cell_accessible_get_name; - atk_object_class->ref_state_set = gtk_text_cell_accessible_ref_state_set; - - gobject_class->finalize = gtk_text_cell_accessible_finalize; -} - -static void -gtk_text_cell_accessible_init (GtkTextCellAccessible *text_cell) -{ - text_cell->priv = gtk_text_cell_accessible_get_instance_private (text_cell); - text_cell->priv->caret_pos = -1; -} - -static char * -gtk_text_cell_accessible_get_text (AtkText *atk_text, - int start_pos, - int end_pos) -{ - char *text; - - text = GTK_TEXT_CELL_ACCESSIBLE (atk_text)->priv->cell_text; - if (text) - return g_utf8_substring (text, start_pos, end_pos > -1 ? end_pos : g_utf8_strlen (text, -1)); - else - return g_strdup (""); -} - -static char * -gtk_text_cell_accessible_get_text_before_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (atk_text); - char *text; - - text = _gtk_pango_get_text_before (text_cell->priv->layout, boundary_type, offset, start_offset, end_offset); - - return text; -} - -static char * -gtk_text_cell_accessible_get_text_at_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (atk_text); - char *text; - - text = _gtk_pango_get_text_at (text_cell->priv->layout, boundary_type, offset, start_offset, end_offset); - - return text; -} - -static char * -gtk_text_cell_accessible_get_text_after_offset (AtkText *atk_text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (atk_text); - char *text; - - text = _gtk_pango_get_text_after (text_cell->priv->layout, boundary_type, offset, start_offset, end_offset); - - return text; -} - -static int -gtk_text_cell_accessible_get_character_count (AtkText *text) -{ - if (GTK_TEXT_CELL_ACCESSIBLE (text)->priv->cell_text != NULL) - return GTK_TEXT_CELL_ACCESSIBLE (text)->priv->cell_length; - else - return 0; -} - -static int -gtk_text_cell_accessible_get_caret_offset (AtkText *text) -{ - return GTK_TEXT_CELL_ACCESSIBLE (text)->priv->caret_pos; -} - -static gboolean -gtk_text_cell_accessible_set_caret_offset (AtkText *text, - int offset) -{ - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (text); - - if (text_cell->priv->cell_text == NULL) - return FALSE; - else - { - /* Only set the caret within the bounds and if it is to a new position. */ - if (offset >= 0 && - offset <= text_cell->priv->cell_length && - offset != text_cell->priv->caret_pos) - { - text_cell->priv->caret_pos = offset; - - /* emit the signal */ - g_signal_emit_by_name (text, "text-caret-moved", offset); - return TRUE; - } - else - return FALSE; - } -} - -static AtkAttributeSet * -gtk_text_cell_accessible_get_run_attributes (AtkText *text, - int offset, - int *start_offset, - int *end_offset) -{ - AtkAttributeSet *attrib_set = NULL; - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (text); - - attrib_set = _gtk_pango_get_run_attributes (NULL, text_cell->priv->layout, offset, start_offset, end_offset); - - return attrib_set; -} - -static AtkAttributeSet * -add_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - const char *value) -{ - AtkAttribute *at; - - at = g_new (AtkAttribute, 1); - at->name = g_strdup (atk_text_attribute_get_name (attr)); - at->value = g_strdup (value); - - return g_slist_prepend (attributes, at); -} - -static AtkAttributeSet * -gtk_text_cell_accessible_get_default_attributes (AtkText *text) -{ - AtkAttributeSet *attrib_set = NULL; - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (text); - GtkWidget *widget; - - widget = get_widget (GTK_TEXT_CELL_ACCESSIBLE (text)); - - attrib_set = add_attribute (attrib_set, ATK_TEXT_ATTR_DIRECTION, - atk_text_attribute_get_value (ATK_TEXT_ATTR_DIRECTION, - gtk_widget_get_direction (widget))); - attrib_set = _gtk_pango_get_default_attributes (NULL, text_cell->priv->layout); - - attrib_set = _gtk_style_context_get_attributes (attrib_set, - gtk_widget_get_style_context (widget)); - - return attrib_set; -} - -GtkWidget * -get_widget (GtkTextCellAccessible *text) -{ - AtkObject *parent; - - parent = atk_object_get_parent (ATK_OBJECT (text)); - if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent)) - parent = atk_object_get_parent (parent); - - return gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); -} - -/* This function is used by gtk_text_cell_accessible_get_offset_at_point() - * and gtk_text_cell_accessible_get_character_extents(). There is no - * cached PangoLayout so we must create a temporary one using this function. - */ -static PangoLayout * -create_pango_layout (GtkTextCellAccessible *text) -{ - GdkRGBA *foreground_rgba; - PangoAttrList *attr_list, *attributes; - PangoLayout *layout; - PangoUnderline uline, underline; - PangoFontMask mask; - PangoFontDescription *font_desc; - gboolean foreground_set, strikethrough_set, strikethrough; - gboolean scale_set, underline_set, rise_set; - char *renderer_text; - double scale; - int rise; - GtkRendererCellAccessible *gail_renderer; - GtkCellRendererText *gtk_renderer; - - gail_renderer = GTK_RENDERER_CELL_ACCESSIBLE (text); - g_object_get (gail_renderer, "renderer", >k_renderer, NULL); - - g_object_get (gtk_renderer, - "text", &renderer_text, - "attributes", &attributes, - "foreground-set", &foreground_set, - "foreground-rgba", &foreground_rgba, - "strikethrough-set", &strikethrough_set, - "strikethrough", &strikethrough, - "font-desc", &font_desc, - "scale-set", &scale_set, - "scale", &scale, - "underline-set", &underline_set, - "underline", &underline, - "rise-set", &rise_set, - "rise", &rise, - NULL); - g_object_unref (gtk_renderer); - - layout = gtk_widget_create_pango_layout (get_widget (text), renderer_text); - - if (attributes) - attr_list = pango_attr_list_copy (attributes); - else - attr_list = pango_attr_list_new (); - - if (foreground_set) - { - add_attr (attr_list, pango_attr_foreground_new (foreground_rgba->red * 65535, - foreground_rgba->green * 65535, - foreground_rgba->blue * 65535)); - } - - if (strikethrough_set) - add_attr (attr_list, - pango_attr_strikethrough_new (strikethrough)); - - mask = pango_font_description_get_set_fields (font_desc); - - if (mask & PANGO_FONT_MASK_FAMILY) - add_attr (attr_list, - pango_attr_family_new (pango_font_description_get_family (font_desc))); - - if (mask & PANGO_FONT_MASK_STYLE) - add_attr (attr_list, pango_attr_style_new (pango_font_description_get_style (font_desc))); - - if (mask & PANGO_FONT_MASK_VARIANT) - add_attr (attr_list, pango_attr_variant_new (pango_font_description_get_variant (font_desc))); - - if (mask & PANGO_FONT_MASK_WEIGHT) - add_attr (attr_list, pango_attr_weight_new (pango_font_description_get_weight (font_desc))); - - if (mask & PANGO_FONT_MASK_STRETCH) - add_attr (attr_list, pango_attr_stretch_new (pango_font_description_get_stretch (font_desc))); - - if (mask & PANGO_FONT_MASK_SIZE) - add_attr (attr_list, pango_attr_size_new (pango_font_description_get_size (font_desc))); - - if (scale_set && scale != 1.0) - add_attr (attr_list, pango_attr_scale_new (scale)); - - if (underline_set) - uline = underline; - else - uline = PANGO_UNDERLINE_NONE; - - if (uline != PANGO_UNDERLINE_NONE) - add_attr (attr_list, - pango_attr_underline_new (underline)); - - if (rise_set) - add_attr (attr_list, pango_attr_rise_new (rise)); - - pango_layout_set_attributes (layout, attr_list); - pango_layout_set_width (layout, -1); - pango_attr_list_unref (attr_list); - - pango_font_description_free (font_desc); - pango_attr_list_unref (attributes); - g_free (renderer_text); - gdk_rgba_free (foreground_rgba); - - return layout; -} - -static void -add_attr (PangoAttrList *attr_list, - PangoAttribute *attr) -{ - attr->start_index = 0; - attr->end_index = G_MAXINT; - pango_attr_list_insert (attr_list, attr); -} - -static void -gtk_text_cell_accessible_get_character_extents (AtkText *text, - int offset, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coords) -{ - GtkRendererCellAccessible *gail_renderer; - GtkRequisition min_size; - GtkCellRendererText *gtk_renderer; - GdkRectangle rendered_rect; - GtkWidget *widget; - AtkObject *parent; - PangoRectangle char_rect; - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (text); - char *renderer_text; - float xalign, yalign; - int x_offset, y_offset, index; - int xpad, ypad; - - if (!GTK_TEXT_CELL_ACCESSIBLE (text)->priv->cell_text) - { - *x = *y = *height = *width = 0; - return; - } - if (offset < 0 || offset >= GTK_TEXT_CELL_ACCESSIBLE (text)->priv->cell_length) - { - *x = *y = *height = *width = 0; - return; - } - gail_renderer = GTK_RENDERER_CELL_ACCESSIBLE (text); - g_object_get (gail_renderer, "renderer", >k_renderer, NULL); - g_object_get (gtk_renderer, "text", &renderer_text, NULL); - if (renderer_text == NULL) - { - g_object_unref (gtk_renderer); - return; - } - - parent = atk_object_get_parent (ATK_OBJECT (text)); - if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent)) - parent = atk_object_get_parent (parent); - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); - g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent)); - gtk_cell_accessible_parent_get_cell_area (GTK_CELL_ACCESSIBLE_PARENT (parent), - GTK_CELL_ACCESSIBLE (text), - &rendered_rect); - - gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer), - widget, - &min_size, NULL); - - gtk_cell_renderer_get_alignment (GTK_CELL_RENDERER (gtk_renderer), &xalign, &yalign); - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - xalign = 1.0 - xalign; - x_offset = MAX (0, xalign * (rendered_rect.width - min_size.width)); - y_offset = MAX (0, yalign * (rendered_rect.height - min_size.height)); - - index = g_utf8_offset_to_pointer (renderer_text, offset) - renderer_text; - pango_layout_index_to_pos (text_cell->priv->layout, index, &char_rect); - - gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (gtk_renderer), &xpad, &ypad); - - *x = (char_rect.x / PANGO_SCALE) + x_offset + rendered_rect.x + xpad; - *y = (char_rect.y / PANGO_SCALE) + y_offset + rendered_rect.y + ypad; - *height = char_rect.height / PANGO_SCALE; - *width = char_rect.width / PANGO_SCALE; - - if (coords == ATK_XY_SCREEN) - { - *x = 0; - *y = 0; - *height = 0; - *width = 0; - } - - g_free (renderer_text); - g_object_unref (gtk_renderer); -} - -static int -gtk_text_cell_accessible_get_offset_at_point (AtkText *text, - int x, - int y, - AtkCoordType coords) -{ - AtkObject *parent; - GtkRendererCellAccessible *gail_renderer; - GtkCellRendererText *gtk_renderer; - GtkRequisition min_size; - GtkWidget *widget; - GdkRectangle rendered_rect; - GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (text); - char *renderer_text; - float xalign, yalign; - int x_offset, y_offset, index; - int xpad, ypad; - int x_temp, y_temp; - gboolean ret; - - if (!GTK_TEXT_CELL_ACCESSIBLE (text)->priv->cell_text) - return -1; - - gail_renderer = GTK_RENDERER_CELL_ACCESSIBLE (text); - g_object_get (gail_renderer, "renderer", >k_renderer, NULL); - parent = atk_object_get_parent (ATK_OBJECT (text)); - - g_object_get (gtk_renderer, "text", &renderer_text, NULL); - if (text == NULL) - { - g_object_unref (gtk_renderer); - g_free (renderer_text); - return -1; - } - - if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent)) - parent = atk_object_get_parent (parent); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); - - g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), -1); - gtk_cell_accessible_parent_get_cell_area (GTK_CELL_ACCESSIBLE_PARENT (parent), - GTK_CELL_ACCESSIBLE (text), - &rendered_rect); - - gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer), - widget, - &min_size, NULL); - gtk_cell_renderer_get_alignment (GTK_CELL_RENDERER (gtk_renderer), &xalign, &yalign); - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - xalign = 1.0 - xalign; - x_offset = MAX (0, xalign * (rendered_rect.width - min_size.width)); - y_offset = MAX (0, yalign * (rendered_rect.height - min_size.height)); - - gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (gtk_renderer), &xpad, &ypad); - - x_temp = x - (x_offset + rendered_rect.x + xpad); - y_temp = y - (y_offset + rendered_rect.y + ypad); - - if (coords == ATK_XY_SCREEN) - index = -1; - - ret = pango_layout_xy_to_index (text_cell->priv->layout, - x_temp * PANGO_SCALE, - y_temp * PANGO_SCALE, - &index, NULL); - if (!ret) - { - if (x_temp < 0 || y_temp < 0) - index = 0; - else - index = -1; - } - - g_object_unref (gtk_renderer); - - if (index == -1) - { - if (coords == ATK_XY_WINDOW || coords == ATK_XY_SCREEN) - { - glong length; - - length = g_utf8_strlen (renderer_text, -1); - g_free (renderer_text); - - return length; - } - - g_free (renderer_text); - - return index; - } - else - { - glong offset; - - offset = g_utf8_pointer_to_offset (renderer_text, - renderer_text + index); - g_free (renderer_text); - - return offset; - } -} - -static gunichar -gtk_text_cell_accessible_get_character_at_offset (AtkText *text, - int offset) -{ - char *index; - char *string; - - string = GTK_TEXT_CELL_ACCESSIBLE(text)->priv->cell_text; - - if (!string) - return '\0'; - - if (offset >= g_utf8_strlen (string, -1)) - return '\0'; - - index = g_utf8_offset_to_pointer (string, offset); - - return g_utf8_get_char (index); -} - -static void -atk_text_interface_init (AtkTextIface *iface) -{ - iface->get_text = gtk_text_cell_accessible_get_text; - iface->get_character_at_offset = gtk_text_cell_accessible_get_character_at_offset; - iface->get_text_before_offset = gtk_text_cell_accessible_get_text_before_offset; - iface->get_text_at_offset = gtk_text_cell_accessible_get_text_at_offset; - iface->get_text_after_offset = gtk_text_cell_accessible_get_text_after_offset; - iface->get_character_count = gtk_text_cell_accessible_get_character_count; - iface->get_caret_offset = gtk_text_cell_accessible_get_caret_offset; - iface->set_caret_offset = gtk_text_cell_accessible_set_caret_offset; - iface->get_run_attributes = gtk_text_cell_accessible_get_run_attributes; - iface->get_default_attributes = gtk_text_cell_accessible_get_default_attributes; - iface->get_character_extents = gtk_text_cell_accessible_get_character_extents; - iface->get_offset_at_point = gtk_text_cell_accessible_get_offset_at_point; -} diff --git a/gtk/a11y/gtktextcellaccessible.h b/gtk/a11y/gtktextcellaccessible.h deleted file mode 100644 index 16a63b7518..0000000000 --- a/gtk/a11y/gtktextcellaccessible.h +++ /dev/null @@ -1,58 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_TEXT_CELL_ACCESSIBLE_H__ -#define __GTK_TEXT_CELL_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <atk/atk.h> -#include <gtk/a11y/gtkrenderercellaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_TEXT_CELL_ACCESSIBLE (gtk_text_cell_accessible_get_type ()) -#define GTK_TEXT_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_CELL_ACCESSIBLE, GtkTextCellAccessible)) -#define GTK_TEXT_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TEXT_CELL_ACCESSIBLE, GtkTextCellAccessibleClass)) -#define GTK_IS_TEXT_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_CELL_ACCESSIBLE)) -#define GTK_IS_TEXT_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_CELL_ACCESSIBLE)) -#define GTK_TEXT_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_CELL_ACCESSIBLE, GtkTextCellAccessibleClass)) - -typedef struct _GtkTextCellAccessible GtkTextCellAccessible; -typedef struct _GtkTextCellAccessibleClass GtkTextCellAccessibleClass; -typedef struct _GtkTextCellAccessiblePrivate GtkTextCellAccessiblePrivate; - -struct _GtkTextCellAccessible -{ - GtkRendererCellAccessible parent; - - GtkTextCellAccessiblePrivate *priv; -}; - -struct _GtkTextCellAccessibleClass -{ - GtkRendererCellAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_text_cell_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_TEXT_CELL_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtktextviewaccessible.c b/gtk/a11y/gtktextviewaccessible.c deleted file mode 100644 index 3de00eec92..0000000000 --- a/gtk/a11y/gtktextviewaccessible.c +++ /dev/null @@ -1,1819 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <sys/types.h> - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#include <string.h> -#include <stdlib.h> -#include <glib-object.h> -#include <glib/gstdio.h> -#include <gtk/gtk.h> -#include "gtktextviewaccessibleprivate.h" -#include "gtktextbufferprivate.h" -#include "gtktextviewprivate.h" -#include "gtk/gtkwidgetprivate.h" - -struct _GtkTextViewAccessiblePrivate -{ - int insert_offset; - int selection_bound; -}; - -static void insert_text_cb (GtkTextBuffer *buffer, - GtkTextIter *arg1, - char *arg2, - int arg3, - gpointer user_data); -static void delete_range_cb (GtkTextBuffer *buffer, - GtkTextIter *arg1, - GtkTextIter *arg2, - gpointer user_data); -static void delete_range_after_cb (GtkTextBuffer *buffer, - GtkTextIter *arg1, - GtkTextIter *arg2, - gpointer user_data); -static void mark_set_cb (GtkTextBuffer *buffer, - GtkTextIter *arg1, - GtkTextMark *arg2, - gpointer user_data); - - -static void atk_editable_text_interface_init (AtkEditableTextIface *iface); -static void atk_text_interface_init (AtkTextIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkTextViewAccessible, gtk_text_view_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkTextViewAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init)) - - -static void -on_editable_changed (GObject *gobject, - GParamSpec *pspec, - AtkObject *accessible) -{ - GtkTextView *text_view = GTK_TEXT_VIEW (gobject); - - atk_object_notify_state_change (accessible, - ATK_STATE_EDITABLE, - gtk_text_view_get_editable (text_view)); -} - -static void -gtk_text_view_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_text_view_accessible_parent_class)->initialize (obj, data); - - obj->role = ATK_ROLE_TEXT; - - g_signal_connect (data, "notify::editable", - G_CALLBACK (on_editable_changed), - obj); -} - -static AtkStateSet* -gtk_text_view_accessible_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - state_set = ATK_OBJECT_CLASS (gtk_text_view_accessible_parent_class)->ref_state_set (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - { - atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT); - return state_set; - } - - if (gtk_text_view_get_editable (GTK_TEXT_VIEW (widget))) - atk_state_set_add_state (state_set, ATK_STATE_EDITABLE); - atk_state_set_add_state (state_set, ATK_STATE_MULTI_LINE); - - return state_set; -} - -static void -gtk_text_view_accessible_change_buffer (GtkTextViewAccessible *accessible, - GtkTextBuffer *old_buffer, - GtkTextBuffer *new_buffer) -{ - if (old_buffer) - { - g_signal_handlers_disconnect_matched (old_buffer, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, accessible); - - g_signal_emit_by_name (accessible, - "text-changed::delete", - 0, - gtk_text_buffer_get_char_count (old_buffer)); - } - - if (new_buffer) - { - g_signal_connect_after (new_buffer, "insert-text", G_CALLBACK (insert_text_cb), accessible); - g_signal_connect (new_buffer, "delete-range", G_CALLBACK (delete_range_cb), accessible); - g_signal_connect_after (new_buffer, "delete-range", G_CALLBACK (delete_range_after_cb), accessible); - g_signal_connect_after (new_buffer, "mark-set", G_CALLBACK (mark_set_cb), accessible); - - g_signal_emit_by_name (accessible, - "text-changed::insert", - 0, - gtk_text_buffer_get_char_count (new_buffer)); - } -} - -static void -gtk_text_view_accessible_widget_set (GtkAccessible *accessible) -{ - gtk_text_view_accessible_change_buffer (GTK_TEXT_VIEW_ACCESSIBLE (accessible), - NULL, - gtk_text_view_get_buffer (GTK_TEXT_VIEW (gtk_accessible_get_widget (accessible)))); -} - -static void -gtk_text_view_accessible_widget_unset (GtkAccessible *accessible) -{ - gtk_text_view_accessible_change_buffer (GTK_TEXT_VIEW_ACCESSIBLE (accessible), - gtk_text_view_get_buffer (GTK_TEXT_VIEW (gtk_accessible_get_widget (accessible))), - NULL); -} - -static void -gtk_text_view_accessible_class_init (GtkTextViewAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - GtkAccessibleClass *accessible_class = GTK_ACCESSIBLE_CLASS (klass); - - accessible_class->widget_set = gtk_text_view_accessible_widget_set; - accessible_class->widget_unset = gtk_text_view_accessible_widget_unset; - - class->ref_state_set = gtk_text_view_accessible_ref_state_set; - class->initialize = gtk_text_view_accessible_initialize; -} - -static void -gtk_text_view_accessible_init (GtkTextViewAccessible *accessible) -{ - accessible->priv = gtk_text_view_accessible_get_instance_private (accessible); -} - -static char * -gtk_text_view_accessible_get_text (AtkText *text, - int start_offset, - int end_offset) -{ - GtkTextView *view; - GtkTextBuffer *buffer; - GtkTextIter start, end; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - view = GTK_TEXT_VIEW (widget); - buffer = gtk_text_view_get_buffer (view); - gtk_text_buffer_get_iter_at_offset (buffer, &start, start_offset); - gtk_text_buffer_get_iter_at_offset (buffer, &end, end_offset); - - return gtk_text_buffer_get_text (buffer, &start, &end, FALSE); -} - -static char * -gtk_text_view_accessible_get_text_after_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - GtkTextView *view; - GtkTextBuffer *buffer; - GtkTextIter pos; - GtkTextIter start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - view = GTK_TEXT_VIEW (widget); - buffer = gtk_text_view_get_buffer (view); - gtk_text_buffer_get_iter_at_offset (buffer, &pos, offset); - start = end = pos; - if (boundary_type == ATK_TEXT_BOUNDARY_LINE_START) - { - gtk_text_view_forward_display_line (view, &end); - start = end; - gtk_text_view_forward_display_line (view, &end); - } - else if (boundary_type == ATK_TEXT_BOUNDARY_LINE_END) - { - gtk_text_view_forward_display_line_end (view, &end); - start = end; - gtk_text_view_forward_display_line (view, &end); - gtk_text_view_forward_display_line_end (view, &end); - } - else - _gtk_text_buffer_get_text_after (buffer, boundary_type, &pos, &start, &end); - - *start_offset = gtk_text_iter_get_offset (&start); - *end_offset = gtk_text_iter_get_offset (&end); - - return gtk_text_buffer_get_slice (buffer, &start, &end, FALSE); -} - -static char * -gtk_text_view_accessible_get_text_at_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - GtkTextView *view; - GtkTextBuffer *buffer; - GtkTextIter pos; - GtkTextIter start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - view = GTK_TEXT_VIEW (widget); - buffer = gtk_text_view_get_buffer (view); - gtk_text_buffer_get_iter_at_offset (buffer, &pos, offset); - start = end = pos; - if (boundary_type == ATK_TEXT_BOUNDARY_LINE_START) - { - gtk_text_view_backward_display_line_start (view, &start); - gtk_text_view_forward_display_line (view, &end); - } - else if (boundary_type == ATK_TEXT_BOUNDARY_LINE_END) - { - gtk_text_view_backward_display_line_start (view, &start); - if (!gtk_text_iter_is_start (&start)) - { - gtk_text_view_backward_display_line (view, &start); - gtk_text_view_forward_display_line_end (view, &start); - } - gtk_text_view_forward_display_line_end (view, &end); - } - else - _gtk_text_buffer_get_text_at (buffer, boundary_type, &pos, &start, &end); - - *start_offset = gtk_text_iter_get_offset (&start); - *end_offset = gtk_text_iter_get_offset (&end); - - return gtk_text_buffer_get_slice (buffer, &start, &end, FALSE); -} - -static char * -gtk_text_view_accessible_get_text_before_offset (AtkText *text, - int offset, - AtkTextBoundary boundary_type, - int *start_offset, - int *end_offset) -{ - GtkWidget *widget; - GtkTextView *view; - GtkTextBuffer *buffer; - GtkTextIter pos; - GtkTextIter start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - view = GTK_TEXT_VIEW (widget); - buffer = gtk_text_view_get_buffer (view); - gtk_text_buffer_get_iter_at_offset (buffer, &pos, offset); - start = end = pos; - - if (boundary_type == ATK_TEXT_BOUNDARY_LINE_START) - { - gtk_text_view_backward_display_line_start (view, &start); - end = start; - gtk_text_view_backward_display_line (view, &start); - gtk_text_view_backward_display_line_start (view, &start); - } - else if (boundary_type == ATK_TEXT_BOUNDARY_LINE_END) - { - gtk_text_view_backward_display_line_start (view, &start); - if (!gtk_text_iter_is_start (&start)) - { - gtk_text_view_backward_display_line (view, &start); - end = start; - gtk_text_view_forward_display_line_end (view, &end); - if (!gtk_text_iter_is_start (&start)) - { - if (gtk_text_view_backward_display_line (view, &start)) - gtk_text_view_forward_display_line_end (view, &start); - else - gtk_text_iter_set_offset (&start, 0); - } - } - else - end = start; - } - else - _gtk_text_buffer_get_text_before (buffer, boundary_type, &pos, &start, &end); - - *start_offset = gtk_text_iter_get_offset (&start); - *end_offset = gtk_text_iter_get_offset (&end); - - return gtk_text_buffer_get_slice (buffer, &start, &end, FALSE); -} - -static gunichar -gtk_text_view_accessible_get_character_at_offset (AtkText *text, - int offset) -{ - GtkWidget *widget; - GtkTextIter start, end; - GtkTextBuffer *buffer; - char *string; - gunichar unichar; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return '\0'; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - if (offset >= gtk_text_buffer_get_char_count (buffer)) - return '\0'; - - gtk_text_buffer_get_iter_at_offset (buffer, &start, offset); - end = start; - gtk_text_iter_forward_char (&end); - string = gtk_text_buffer_get_slice (buffer, &start, &end, FALSE); - unichar = g_utf8_get_char (string); - g_free (string); - - return unichar; -} - -static int -gtk_text_view_accessible_get_character_count (AtkText *text) -{ - GtkWidget *widget; - GtkTextBuffer *buffer; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return 0; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - return gtk_text_buffer_get_char_count (buffer); -} - -static int -get_insert_offset (GtkTextBuffer *buffer) -{ - GtkTextMark *insert; - GtkTextIter iter; - - insert = gtk_text_buffer_get_insert (buffer); - gtk_text_buffer_get_iter_at_mark (buffer, &iter, insert); - return gtk_text_iter_get_offset (&iter); -} - -static int -gtk_text_view_accessible_get_caret_offset (AtkText *text) -{ - GtkWidget *widget; - GtkTextBuffer *buffer; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return -1; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - return get_insert_offset (buffer); -} - -static gboolean -gtk_text_view_accessible_set_caret_offset (AtkText *text, - int offset) -{ - GtkTextView *view; - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextIter iter; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - view = GTK_TEXT_VIEW (widget); - buffer = gtk_text_view_get_buffer (view); - - gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset); - gtk_text_buffer_place_cursor (buffer, &iter); - gtk_text_view_scroll_to_iter (view, &iter, 0, FALSE, 0, 0); - - return TRUE; -} - -static int -gtk_text_view_accessible_get_offset_at_point (AtkText *text, - int x, - int y, - AtkCoordType coords) -{ - GtkTextView *view; - GtkTextIter iter; - int buff_x, buff_y; - GtkWidget *widget; - GdkRectangle rect; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return -1; - - if (coords != ATK_XY_WINDOW) - return -1; - - view = GTK_TEXT_VIEW (widget); - - gtk_text_view_window_to_buffer_coords (view, GTK_TEXT_WINDOW_WIDGET, - x, y, &buff_x, &buff_y); - gtk_text_view_get_visible_rect (view, &rect); - - /* Clamp point to visible rectangle */ - buff_x = CLAMP (buff_x, rect.x, rect.x + rect.width - 1); - buff_y = CLAMP (buff_y, rect.y, rect.y + rect.height - 1); - - gtk_text_view_get_iter_at_location (view, &iter, buff_x, buff_y); - - /* The iter at a location sometimes points to the next character. - * See bug 111031. We work around that - */ - gtk_text_view_get_iter_location (view, &iter, &rect); - if (buff_x < rect.x) - gtk_text_iter_backward_char (&iter); - return gtk_text_iter_get_offset (&iter); -} - -static void -gtk_text_view_accessible_get_character_extents (AtkText *text, - int offset, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coords) -{ - GtkTextView *view; - GtkTextBuffer *buffer; - GtkTextIter iter; - GtkWidget *widget; - GdkRectangle rectangle; - - *x = 0; - *y = 0; - *width = 0; - *height = 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - view = GTK_TEXT_VIEW (widget); - buffer = gtk_text_view_get_buffer (view); - gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset); - gtk_text_view_get_iter_location (view, &iter, &rectangle); - - *height = rectangle.height; - *width = rectangle.width; - - gtk_text_view_buffer_to_window_coords (view, GTK_TEXT_WINDOW_WIDGET, - rectangle.x, rectangle.y, x, y); - if (coords != ATK_XY_WINDOW) - { - *x = 0; - *y = 0; - *height = 0; - *width = 0; - } -} - -static AtkAttributeSet * -add_text_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - char *value) -{ - AtkAttribute *at; - - at = g_new (AtkAttribute, 1); - at->name = g_strdup (atk_text_attribute_get_name (attr)); - at->value = value; - - return g_slist_prepend (attributes, at); -} - -static AtkAttributeSet * -add_text_int_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - int i) - -{ - char *value; - - value = g_strdup (atk_text_attribute_get_value (attr, i)); - - return add_text_attribute (attributes, attr, value); -} - -static AtkAttributeSet * -gtk_text_view_accessible_get_run_attributes (AtkText *text, - int offset, - int *start_offset, - int *end_offset) -{ - GtkTextView *view; - GtkTextBuffer *buffer; - GtkWidget *widget; - GtkTextIter iter; - AtkAttributeSet *attrib_set = NULL; - GSList *tags, *temp_tags; - double scale = 1; - gboolean val_set = FALSE; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - view = GTK_TEXT_VIEW (widget); - buffer = gtk_text_view_get_buffer (view); - - gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset); - - gtk_text_iter_forward_to_tag_toggle (&iter, NULL); - *end_offset = gtk_text_iter_get_offset (&iter); - - gtk_text_iter_backward_to_tag_toggle (&iter, NULL); - *start_offset = gtk_text_iter_get_offset (&iter); - - gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset); - - tags = gtk_text_iter_get_tags (&iter); - tags = g_slist_reverse (tags); - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "style-set", &val_set, NULL); - if (val_set) - { - PangoStyle style; - g_object_get (tag, "style", &style, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_STYLE, style); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "variant-set", &val_set, NULL); - if (val_set) - { - PangoVariant variant; - g_object_get (tag, "variant", &variant, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_VARIANT, variant); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "stretch-set", &val_set, NULL); - if (val_set) - { - PangoStretch stretch; - g_object_get (tag, "stretch", &stretch, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_STRETCH, stretch); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "justification-set", &val_set, NULL); - if (val_set) - { - GtkJustification justification; - g_object_get (tag, "justification", &justification, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_JUSTIFICATION, justification); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - GtkTextDirection direction; - - g_object_get (tag, "direction", &direction, NULL); - - if (direction != GTK_TEXT_DIR_NONE) - { - val_set = TRUE; - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_DIRECTION, direction); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "wrap-mode-set", &val_set, NULL); - if (val_set) - { - GtkWrapMode wrap_mode; - g_object_get (tag, "wrap-mode", &wrap_mode, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_WRAP_MODE, wrap_mode); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "foreground-set", &val_set, NULL); - if (val_set) - { - GdkRGBA *rgba; - char *value; - - g_object_get (tag, "foreground-rgba", &rgba, NULL); - value = g_strdup_printf ("%u,%u,%u", - (guint) rgba->red * 65535, - (guint) rgba->green * 65535, - (guint) rgba->blue * 65535); - gdk_rgba_free (rgba); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_FG_COLOR, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "background-set", &val_set, NULL); - if (val_set) - { - GdkRGBA *rgba; - char *value; - - g_object_get (tag, "background-rgba", &rgba, NULL); - value = g_strdup_printf ("%u,%u,%u", - (guint) rgba->red * 65535, - (guint) rgba->green * 65535, - (guint) rgba->blue * 65535); - gdk_rgba_free (rgba); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_BG_COLOR, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "family-set", &val_set, NULL); - - if (val_set) - { - char *value; - g_object_get (tag, "family", &value, NULL); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_FAMILY_NAME, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "language-set", &val_set, NULL); - - if (val_set) - { - char *value; - g_object_get (tag, "language", &value, NULL); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_LANGUAGE, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "weight-set", &val_set, NULL); - - if (val_set) - { - int weight; - char *value; - g_object_get (tag, "weight", &weight, NULL); - value = g_strdup_printf ("%d", weight); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_WEIGHT, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - /* scale is special as the effective value is the product - * of all specified values - */ - temp_tags = tags; - while (temp_tags) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - gboolean scale_set; - - g_object_get (tag, "scale-set", &scale_set, NULL); - if (scale_set) - { - double font_scale; - g_object_get (tag, "scale", &font_scale, NULL); - val_set = TRUE; - scale *= font_scale; - } - temp_tags = temp_tags->next; - } - if (val_set) - { - char *value; - value = g_strdup_printf ("%g", scale); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_SCALE, value); - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "size-set", &val_set, NULL); - if (val_set) - { - int size; - char *value; - g_object_get (tag, "size", &size, NULL); - value = g_strdup_printf ("%i", size); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_SIZE, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "strikethrough-set", &val_set, NULL); - if (val_set) - { - gboolean strikethrough; - g_object_get (tag, "strikethrough", &strikethrough, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_STRIKETHROUGH, strikethrough); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "underline-set", &val_set, NULL); - if (val_set) - { - PangoUnderline underline; - g_object_get (tag, "underline", &underline, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_UNDERLINE, underline); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "rise-set", &val_set, NULL); - if (val_set) - { - int rise; - char *value; - g_object_get (tag, "rise", &rise, NULL); - value = g_strdup_printf ("%i", rise); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_RISE, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "background-full-height-set", &val_set, NULL); - if (val_set) - { - gboolean bg_full_height; - g_object_get (tag, "background-full-height", &bg_full_height, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_BG_FULL_HEIGHT, bg_full_height); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "pixels-inside-wrap-set", &val_set, NULL); - if (val_set) - { - int pixels; - char *value; - g_object_get (tag, "pixels-inside-wrap", &pixels, NULL); - value = g_strdup_printf ("%i", pixels); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "pixels-below-lines-set", &val_set, NULL); - if (val_set) - { - int pixels; - char *value; - g_object_get (tag, "pixels-below-lines", &pixels, NULL); - value = g_strdup_printf ("%i", pixels); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_BELOW_LINES, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "pixels-above-lines-set", &val_set, NULL); - if (val_set) - { - int pixels; - char *value; - g_object_get (tag, "pixels-above-lines", &pixels, NULL); - value = g_strdup_printf ("%i", pixels); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_ABOVE_LINES, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "editable-set", &val_set, NULL); - if (val_set) - { - gboolean editable; - g_object_get (tag, "editable", &editable, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_EDITABLE, editable); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "invisible-set", &val_set, NULL); - if (val_set) - { - gboolean invisible; - g_object_get (tag, "invisible", &invisible, NULL); - attrib_set = add_text_int_attribute (attrib_set, ATK_TEXT_ATTR_INVISIBLE, invisible); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "indent-set", &val_set, NULL); - if (val_set) - { - int indent; - char *value; - g_object_get (tag, "indent", &indent, NULL); - value = g_strdup_printf ("%i", indent); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_INDENT, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "right-margin-set", &val_set, NULL); - if (val_set) - { - int margin; - char *value; - g_object_get (tag, "right-margin", &margin, NULL); - value = g_strdup_printf ("%i", margin); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_RIGHT_MARGIN, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - g_object_get (tag, "left-margin-set", &val_set, NULL); - if (val_set) - { - int margin; - char *value; - g_object_get (tag, "left-margin", &margin, NULL); - value = g_strdup_printf ("%i", margin); - attrib_set = add_text_attribute (attrib_set, ATK_TEXT_ATTR_LEFT_MARGIN, value); - } - temp_tags = temp_tags->next; - } - val_set = FALSE; - - g_slist_free (tags); - return attrib_set; -} - -static AtkAttributeSet * -gtk_text_view_accessible_get_default_attributes (AtkText *text) -{ - GtkTextView *view; - GtkWidget *widget; - GtkTextAttributes *text_attrs; - AtkAttributeSet *attributes; - PangoFontDescription *font; - char *value; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return NULL; - - view = GTK_TEXT_VIEW (widget); - text_attrs = gtk_text_view_get_default_attributes (view); - - attributes = NULL; - - font = text_attrs->font; - - if (font) - { - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_STYLE, - pango_font_description_get_style (font)); - - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_VARIANT, - pango_font_description_get_variant (font)); - - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_STRETCH, - pango_font_description_get_stretch (font)); - - value = g_strdup (pango_font_description_get_family (font)); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_FAMILY_NAME, value); - - value = g_strdup_printf ("%d", pango_font_description_get_weight (font)); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_WEIGHT, value); - - value = g_strdup_printf ("%i", pango_font_description_get_size (font) / PANGO_SCALE); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_SIZE, value); - } - - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_JUSTIFICATION, text_attrs->justification); - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_DIRECTION, text_attrs->direction); - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_WRAP_MODE, text_attrs->wrap_mode); - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_EDITABLE, text_attrs->editable); - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_INVISIBLE, text_attrs->invisible); - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_BG_FULL_HEIGHT, text_attrs->bg_full_height); - - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_STRIKETHROUGH, - text_attrs->appearance.strikethrough); - attributes = add_text_int_attribute (attributes, ATK_TEXT_ATTR_UNDERLINE, - text_attrs->appearance.underline); - - value = g_strdup_printf ("%u,%u,%u", - (guint)(text_attrs->appearance.bg_rgba->red * 65535), - (guint)(text_attrs->appearance.bg_rgba->green * 65535), - (guint)(text_attrs->appearance.bg_rgba->blue * 65535)); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_BG_COLOR, value); - - value = g_strdup_printf ("%u,%u,%u", - (guint)(text_attrs->appearance.fg_rgba->red), - (guint)(text_attrs->appearance.fg_rgba->green), - (guint)(text_attrs->appearance.fg_rgba->blue)); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_FG_COLOR, value); - - value = g_strdup_printf ("%g", text_attrs->font_scale); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_SCALE, value); - - value = g_strdup ((char *)(text_attrs->language)); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_LANGUAGE, value); - - value = g_strdup_printf ("%i", text_attrs->appearance.rise); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_RISE, value); - - value = g_strdup_printf ("%i", text_attrs->pixels_inside_wrap); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP, value); - - value = g_strdup_printf ("%i", text_attrs->pixels_below_lines); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_PIXELS_BELOW_LINES, value); - - value = g_strdup_printf ("%i", text_attrs->pixels_above_lines); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_PIXELS_ABOVE_LINES, value); - - value = g_strdup_printf ("%i", text_attrs->indent); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_INDENT, value); - - value = g_strdup_printf ("%i", text_attrs->left_margin); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_LEFT_MARGIN, value); - - value = g_strdup_printf ("%i", text_attrs->right_margin); - attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_RIGHT_MARGIN, value); - - gtk_text_attributes_unref (text_attrs); - return attributes; -} - -static int -gtk_text_view_accessible_get_n_selections (AtkText *text) -{ - GtkWidget *widget; - GtkTextBuffer *buffer; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return 0; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - if (gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL)) - return 1; - - return 0; -} - -static char * -gtk_text_view_accessible_get_selection (AtkText *atk_text, - int selection_num, - int *start_pos, - int *end_pos) -{ - GtkTextView *view; - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextIter start, end; - char *text; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text)); - if (widget == NULL) - return NULL; - - if (selection_num != 0) - return NULL; - - view = GTK_TEXT_VIEW (widget); - buffer = gtk_text_view_get_buffer (view); - - if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end)) - text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); - else - text = NULL; - - *start_pos = gtk_text_iter_get_offset (&start); - *end_pos = gtk_text_iter_get_offset (&end); - - return text; -} - -static gboolean -gtk_text_view_accessible_add_selection (AtkText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextIter start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - - if (!gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL)) - { - gtk_text_buffer_get_iter_at_offset (buffer, &start, start_pos); - gtk_text_buffer_get_iter_at_offset (buffer, &end, end_pos); - gtk_text_buffer_select_range (buffer, &end, &start); - - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_text_view_accessible_remove_selection (AtkText *text, - int selection_num) -{ - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextMark *insert; - GtkTextIter iter; - GtkTextIter start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - - if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end)) - { - insert = gtk_text_buffer_get_insert (buffer); - gtk_text_buffer_get_iter_at_mark (buffer, &iter, insert); - gtk_text_buffer_place_cursor (buffer, &iter); - return TRUE; - } - else - return FALSE; -} - -static gboolean -gtk_text_view_accessible_set_selection (AtkText *text, - int selection_num, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextIter start, end; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - if (selection_num != 0) - return FALSE; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - - if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end)) - { - gtk_text_buffer_get_iter_at_offset (buffer, &start, start_pos); - gtk_text_buffer_get_iter_at_offset (buffer, &end, end_pos); - gtk_text_buffer_select_range (buffer, &end, &start); - - return TRUE; - } - else - return FALSE; -} - -static void -atk_text_interface_init (AtkTextIface *iface) -{ - iface->get_text = gtk_text_view_accessible_get_text; - iface->get_text_after_offset = gtk_text_view_accessible_get_text_after_offset; - iface->get_text_at_offset = gtk_text_view_accessible_get_text_at_offset; - iface->get_text_before_offset = gtk_text_view_accessible_get_text_before_offset; - iface->get_character_at_offset = gtk_text_view_accessible_get_character_at_offset; - iface->get_character_count = gtk_text_view_accessible_get_character_count; - iface->get_caret_offset = gtk_text_view_accessible_get_caret_offset; - iface->set_caret_offset = gtk_text_view_accessible_set_caret_offset; - iface->get_offset_at_point = gtk_text_view_accessible_get_offset_at_point; - iface->get_character_extents = gtk_text_view_accessible_get_character_extents; - iface->get_n_selections = gtk_text_view_accessible_get_n_selections; - iface->get_selection = gtk_text_view_accessible_get_selection; - iface->add_selection = gtk_text_view_accessible_add_selection; - iface->remove_selection = gtk_text_view_accessible_remove_selection; - iface->set_selection = gtk_text_view_accessible_set_selection; - iface->get_run_attributes = gtk_text_view_accessible_get_run_attributes; - iface->get_default_attributes = gtk_text_view_accessible_get_default_attributes; -} - -/* atkeditabletext.h */ - -static gboolean -gtk_text_view_accessible_set_run_attributes (AtkEditableText *text, - AtkAttributeSet *attributes, - int start_offset, - int end_offset) -{ - GtkTextView *view; - GtkTextBuffer *buffer; - GtkWidget *widget; - GtkTextTag *tag; - GtkTextIter start; - GtkTextIter end; - int j; - GdkRGBA *color; - char ** RGB_vals; - GSList *l; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return FALSE; - - view = GTK_TEXT_VIEW (widget); - if (!gtk_text_view_get_editable (view)) - return FALSE; - - buffer = gtk_text_view_get_buffer (view); - - if (attributes == NULL) - return FALSE; - - gtk_text_buffer_get_iter_at_offset (buffer, &start, start_offset); - gtk_text_buffer_get_iter_at_offset (buffer, &end, end_offset); - - tag = gtk_text_buffer_create_tag (buffer, NULL, NULL); - - for (l = attributes; l; l = l->next) - { - char *name; - char *value; - AtkAttribute *at; - - at = l->data; - - name = at->name; - value = at->value; - - if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_LEFT_MARGIN))) - g_object_set (G_OBJECT (tag), "left-margin", atoi (value), NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_RIGHT_MARGIN))) - g_object_set (G_OBJECT (tag), "right-margin", atoi (value), NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_INDENT))) - g_object_set (G_OBJECT (tag), "indent", atoi (value), NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_PIXELS_ABOVE_LINES))) - g_object_set (G_OBJECT (tag), "pixels-above-lines", atoi (value), NULL); - - else if (!strcmp(name, atk_text_attribute_get_name (ATK_TEXT_ATTR_PIXELS_BELOW_LINES))) - g_object_set (G_OBJECT (tag), "pixels-below-lines", atoi (value), NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP))) - g_object_set (G_OBJECT (tag), "pixels-inside-wrap", atoi (value), NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_SIZE))) - g_object_set (G_OBJECT (tag), "size", atoi (value), NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_RISE))) - g_object_set (G_OBJECT (tag), "rise", atoi (value), NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_WEIGHT))) - g_object_set (G_OBJECT (tag), "weight", atoi (value), NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_BG_FULL_HEIGHT))) - { - g_object_set (G_OBJECT (tag), "bg-full-height", - (strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_BG_FULL_HEIGHT, 0))), - NULL); - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_LANGUAGE))) - g_object_set (G_OBJECT (tag), "language", value, NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_FAMILY_NAME))) - g_object_set (G_OBJECT (tag), "family", value, NULL); - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_EDITABLE))) - { - g_object_set (G_OBJECT (tag), "editable", - (strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_EDITABLE, 0))), - NULL); - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_INVISIBLE))) - { - g_object_set (G_OBJECT (tag), "invisible", - (strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_EDITABLE, 0))), - NULL); - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_UNDERLINE))) - { - for (j = 0; j < 3; j++) - { - if (!strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_UNDERLINE, j))) - { - g_object_set (G_OBJECT (tag), "underline", j, NULL); - break; - } - } - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_STRIKETHROUGH))) - { - g_object_set (G_OBJECT (tag), "strikethrough", - (strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_STRIKETHROUGH, 0))), - NULL); - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_BG_COLOR))) - { - RGB_vals = g_strsplit (value, ",", 3); - color = g_malloc (sizeof (GdkRGBA)); - color->red = atoi (RGB_vals[0]) / 65535.0; - color->green = atoi (RGB_vals[1]) / 65535.0; - color->blue = atoi (RGB_vals[2]) / 65535.0; - g_object_set (G_OBJECT (tag), "background-rgba", color, NULL); - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_FG_COLOR))) - { - RGB_vals = g_strsplit (value, ",", 3); - color = g_malloc (sizeof (GdkRGBA)); - color->red = atoi (RGB_vals[0]) / 65535.0; - color->green = atoi (RGB_vals[1]) / 65535.0; - color->blue = atoi (RGB_vals[2]) / 65535.0; - g_object_set (G_OBJECT (tag), "foreground-rgba", color, NULL); - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_STRETCH))) - { - for (j = 0; j < 9; j++) - { - if (!strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_STRETCH, j))) - { - g_object_set (G_OBJECT (tag), "stretch", j, NULL); - break; - } - } - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_JUSTIFICATION))) - { - for (j = 0; j < 4; j++) - { - if (!strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_JUSTIFICATION, j))) - { - g_object_set (G_OBJECT (tag), "justification", j, NULL); - break; - } - } - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_DIRECTION))) - { - for (j = 0; j < 3; j++) - { - if (!strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_DIRECTION, j))) - { - g_object_set (G_OBJECT (tag), "direction", j, NULL); - break; - } - } - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_VARIANT))) - { - for (j = 0; j < 2; j++) - { - if (!strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_VARIANT, j))) - { - g_object_set (G_OBJECT (tag), "variant", j, NULL); - break; - } - } - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_WRAP_MODE))) - { - for (j = 0; j < 3; j++) - { - if (!strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_WRAP_MODE, j))) - { - g_object_set (G_OBJECT (tag), "wrap-mode", j, NULL); - break; - } - } - } - - else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_STYLE))) - { - for (j = 0; j < 3; j++) - { - if (!strcmp (value, atk_text_attribute_get_value (ATK_TEXT_ATTR_STYLE, j))) - { - g_object_set (G_OBJECT (tag), "style", j, NULL); - break; - } - } - } - - else - return FALSE; - } - - gtk_text_buffer_apply_tag (buffer, tag, &start, &end); - - return TRUE; -} - -static void -gtk_text_view_accessible_set_text_contents (AtkEditableText *text, - const char *string) -{ - GtkTextView *view; - GtkWidget *widget; - GtkTextBuffer *buffer; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - view = GTK_TEXT_VIEW (widget); - if (!gtk_text_view_get_editable (view)) - return; - - buffer = gtk_text_view_get_buffer (view); - gtk_text_buffer_set_text (buffer, string, -1); -} - -static void -gtk_text_view_accessible_insert_text (AtkEditableText *text, - const char *string, - int length, - int *position) -{ - GtkTextView *view; - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextIter iter; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - view = GTK_TEXT_VIEW (widget); - if (!gtk_text_view_get_editable (view)) - return; - - buffer = gtk_text_view_get_buffer (view); - gtk_text_buffer_get_iter_at_offset (buffer, &iter, *position); - gtk_text_buffer_insert (buffer, &iter, string, length); -} - -static void -gtk_text_view_accessible_copy_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextIter start, end; - char *str; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - - gtk_text_buffer_get_iter_at_offset (buffer, &start, start_pos); - gtk_text_buffer_get_iter_at_offset (buffer, &end, end_pos); - str = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); - - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_set_text (clipboard, str); -} - -static void -gtk_text_view_accessible_cut_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkTextView *view; - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextIter start, end; - char *str; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - view = GTK_TEXT_VIEW (widget); - if (!gtk_text_view_get_editable (view)) - return; - buffer = gtk_text_view_get_buffer (view); - - gtk_text_buffer_get_iter_at_offset (buffer, &start, start_pos); - gtk_text_buffer_get_iter_at_offset (buffer, &end, end_pos); - str = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_set_text (clipboard, str); - gtk_text_buffer_delete (buffer, &start, &end); -} - -static void -gtk_text_view_accessible_delete_text (AtkEditableText *text, - int start_pos, - int end_pos) -{ - GtkTextView *view; - GtkWidget *widget; - GtkTextBuffer *buffer; - GtkTextIter start_itr; - GtkTextIter end_itr; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - view = GTK_TEXT_VIEW (widget); - if (!gtk_text_view_get_editable (view)) - return; - buffer = gtk_text_view_get_buffer (view); - - gtk_text_buffer_get_iter_at_offset (buffer, &start_itr, start_pos); - gtk_text_buffer_get_iter_at_offset (buffer, &end_itr, end_pos); - gtk_text_buffer_delete (buffer, &start_itr, &end_itr); -} - -typedef struct -{ - GtkTextBuffer* buffer; - int position; -} PasteData; - -static void -paste_received (GObject *clipboard, - GAsyncResult *result, - gpointer data) -{ - PasteData* paste = data; - GtkTextIter pos_itr; - char *text; - - text = gdk_clipboard_read_text_finish (GDK_CLIPBOARD (clipboard), result, NULL); - if (text) - { - gtk_text_buffer_get_iter_at_offset (paste->buffer, &pos_itr, paste->position); - gtk_text_buffer_insert (paste->buffer, &pos_itr, text, -1); - g_free (text); - } - - g_object_unref (paste->buffer); -} - -static void -gtk_text_view_accessible_paste_text (AtkEditableText *text, - int position) -{ - GtkTextView *view; - GtkWidget *widget; - GtkTextBuffer *buffer; - PasteData paste; - GdkClipboard *clipboard; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); - if (widget == NULL) - return; - - view = GTK_TEXT_VIEW (widget); - if (!gtk_text_view_get_editable (view)) - return; - buffer = gtk_text_view_get_buffer (view); - - paste.buffer = buffer; - paste.position = position; - - g_object_ref (paste.buffer); - clipboard = gtk_widget_get_clipboard (widget); - gdk_clipboard_read_text_async (clipboard, NULL, paste_received, &paste); -} - -static void -atk_editable_text_interface_init (AtkEditableTextIface *iface) -{ - iface->set_text_contents = gtk_text_view_accessible_set_text_contents; - iface->insert_text = gtk_text_view_accessible_insert_text; - iface->copy_text = gtk_text_view_accessible_copy_text; - iface->cut_text = gtk_text_view_accessible_cut_text; - iface->delete_text = gtk_text_view_accessible_delete_text; - iface->paste_text = gtk_text_view_accessible_paste_text; - iface->set_run_attributes = gtk_text_view_accessible_set_run_attributes; -} - -/* Callbacks */ - -static void -gtk_text_view_accessible_update_cursor (GtkTextViewAccessible *accessible, - GtkTextBuffer * buffer) -{ - int prev_insert_offset, prev_selection_bound; - int insert_offset, selection_bound; - GtkTextIter iter; - - prev_insert_offset = accessible->priv->insert_offset; - prev_selection_bound = accessible->priv->selection_bound; - - gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer)); - insert_offset = gtk_text_iter_get_offset (&iter); - gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_selection_bound (buffer)); - selection_bound = gtk_text_iter_get_offset (&iter); - - if (prev_insert_offset == insert_offset && prev_selection_bound == selection_bound) - return; - - accessible->priv->insert_offset = insert_offset; - accessible->priv->selection_bound = selection_bound; - - if (prev_insert_offset != insert_offset) - g_signal_emit_by_name (accessible, "text-caret-moved", insert_offset); - - if (prev_insert_offset != prev_selection_bound || insert_offset != selection_bound) - g_signal_emit_by_name (accessible, "text-selection-changed"); -} - -static void -insert_text_cb (GtkTextBuffer *buffer, - GtkTextIter *iter, - char *text, - int len, - gpointer data) -{ - GtkTextViewAccessible *accessible = data; - int position; - int length; - - position = gtk_text_iter_get_offset (iter); - length = g_utf8_strlen (text, len); - - g_signal_emit_by_name (accessible, "text-changed::insert", position - length, length); - - gtk_text_view_accessible_update_cursor (accessible, buffer); -} - -static void -delete_range_cb (GtkTextBuffer *buffer, - GtkTextIter *start, - GtkTextIter *end, - gpointer data) -{ - GtkTextViewAccessible *accessible = data; - int offset, length; - - offset = gtk_text_iter_get_offset (start); - length = gtk_text_iter_get_offset (end) - offset; - - g_signal_emit_by_name (accessible, - "text-changed::delete", - offset, - length); -} - -static void -delete_range_after_cb (GtkTextBuffer *buffer, - GtkTextIter *start, - GtkTextIter *end, - gpointer data) -{ - GtkTextViewAccessible *accessible = data; - - gtk_text_view_accessible_update_cursor (accessible, buffer); -} - -static void -mark_set_cb (GtkTextBuffer *buffer, - GtkTextIter *location, - GtkTextMark *mark, - gpointer data) -{ - GtkTextViewAccessible *accessible = data; - - /* - * Only generate the signal for the "insert" mark, which - * represents the cursor. - */ - if (mark == gtk_text_buffer_get_insert (buffer)) - { - gtk_text_view_accessible_update_cursor (accessible, buffer); - } - else if (mark == gtk_text_buffer_get_selection_bound (buffer)) - { - gtk_text_view_accessible_update_cursor (accessible, buffer); - } -} - -void -_gtk_text_view_accessible_set_buffer (GtkTextView *textview, - GtkTextBuffer *old_buffer) -{ - GtkTextViewAccessible *accessible; - - g_return_if_fail (GTK_IS_TEXT_VIEW (textview)); - g_return_if_fail (old_buffer == NULL || GTK_IS_TEXT_BUFFER (old_buffer)); - - accessible = GTK_TEXT_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (textview))); - if (accessible == NULL) - return; - - gtk_text_view_accessible_change_buffer (accessible, - old_buffer, - gtk_text_view_get_buffer (textview)); -} - diff --git a/gtk/a11y/gtktextviewaccessible.h b/gtk/a11y/gtktextviewaccessible.h deleted file mode 100644 index f8436e150e..0000000000 --- a/gtk/a11y/gtktextviewaccessible.h +++ /dev/null @@ -1,58 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_TEXT_VIEW_ACCESSIBLE_H__ -#define __GTK_TEXT_VIEW_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_TEXT_VIEW_ACCESSIBLE (gtk_text_view_accessible_get_type ()) -#define GTK_TEXT_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_VIEW_ACCESSIBLE, GtkTextViewAccessible)) -#define GTK_TEXT_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_VIEW_ACCESSIBLE, GtkTextViewAccessibleClass)) -#define GTK_IS_TEXT_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_VIEW_ACCESSIBLE)) -#define GTK_IS_TEXT_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_VIEW_ACCESSIBLE)) -#define GTK_TEXT_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_VIEW_ACCESSIBLE, GtkTextViewAccessibleClass)) - -typedef struct _GtkTextViewAccessible GtkTextViewAccessible; -typedef struct _GtkTextViewAccessibleClass GtkTextViewAccessibleClass; -typedef struct _GtkTextViewAccessiblePrivate GtkTextViewAccessiblePrivate; - -struct _GtkTextViewAccessible -{ - GtkWidgetAccessible parent; - - GtkTextViewAccessiblePrivate *priv; -}; - -struct _GtkTextViewAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_text_view_accessible_get_type (void); - - -G_END_DECLS - -#endif /* __GTK_TEXT_VIEW_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtktextviewaccessibleprivate.h b/gtk/a11y/gtktextviewaccessibleprivate.h deleted file mode 100644 index 9fe9b1b585..0000000000 --- a/gtk/a11y/gtktextviewaccessibleprivate.h +++ /dev/null @@ -1,30 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_TEXT_VIEW_ACCESSIBLE_PRIVATE_H__ -#define __GTK_TEXT_VIEW_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtktextviewaccessible.h> - -G_BEGIN_DECLS - -void _gtk_text_view_accessible_set_buffer (GtkTextView *textview, - GtkTextBuffer *old_buffer); - -G_END_DECLS - -#endif /* __GTK_TEXT_VIEW_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtktogglebuttonaccessible.c b/gtk/a11y/gtktogglebuttonaccessible.c deleted file mode 100644 index 53c8174f86..0000000000 --- a/gtk/a11y/gtktogglebuttonaccessible.c +++ /dev/null @@ -1,84 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <string.h> -#include <gtk/gtk.h> -#include "gtktogglebuttonaccessible.h" - - -G_DEFINE_TYPE (GtkToggleButtonAccessible, gtk_toggle_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE) - -static void -gtk_toggle_button_accessible_toggled (GtkWidget *widget) -{ - AtkObject *accessible; - GtkToggleButton *toggle_button; - - toggle_button = GTK_TOGGLE_BUTTON (widget); - - accessible = gtk_widget_get_accessible (widget); - atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, - gtk_toggle_button_get_active (toggle_button)); -} - -static void -gtk_toggle_button_accessible_initialize (AtkObject *obj, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_toggle_button_accessible_parent_class)->initialize (obj, data); - - g_signal_connect (data, "toggled", - G_CALLBACK (gtk_toggle_button_accessible_toggled), NULL); - - obj->role = ATK_ROLE_TOGGLE_BUTTON; -} - -static AtkStateSet* -gtk_toggle_button_accessible_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - GtkToggleButton *toggle_button; - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - state_set = ATK_OBJECT_CLASS (gtk_toggle_button_accessible_parent_class)->ref_state_set (accessible); - toggle_button = GTK_TOGGLE_BUTTON (widget); - - if (gtk_toggle_button_get_active (toggle_button)) - atk_state_set_add_state (state_set, ATK_STATE_CHECKED); - - return state_set; -} - -static void -gtk_toggle_button_accessible_class_init (GtkToggleButtonAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->ref_state_set = gtk_toggle_button_accessible_ref_state_set; - class->initialize = gtk_toggle_button_accessible_initialize; -} - -static void -gtk_toggle_button_accessible_init (GtkToggleButtonAccessible *button) -{ -} diff --git a/gtk/a11y/gtktogglebuttonaccessible.h b/gtk/a11y/gtktogglebuttonaccessible.h deleted file mode 100644 index b45b518343..0000000000 --- a/gtk/a11y/gtktogglebuttonaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_TOGGLE_BUTTON_ACCESSIBLE_H__ -#define __GTK_TOGGLE_BUTTON_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkbuttonaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE (gtk_toggle_button_accessible_get_type ()) -#define GTK_TOGGLE_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE, GtkToggleButtonAccessible)) -#define GTK_TOGGLE_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE, GtkToggleButtonAccessibleClass)) -#define GTK_IS_TOGGLE_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE)) -#define GTK_IS_TOGGLE_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE)) -#define GTK_TOGGLE_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE, GtkToggleButtonAccessibleClass)) - -typedef struct _GtkToggleButtonAccessible GtkToggleButtonAccessible; -typedef struct _GtkToggleButtonAccessibleClass GtkToggleButtonAccessibleClass; -typedef struct _GtkToggleButtonAccessiblePrivate GtkToggleButtonAccessiblePrivate; - -struct _GtkToggleButtonAccessible -{ - GtkButtonAccessible parent; - - GtkToggleButtonAccessiblePrivate *priv; -}; - -struct _GtkToggleButtonAccessibleClass -{ - GtkButtonAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_toggle_button_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_TOGGLE_BUTTON_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtktoplevelaccessible.c b/gtk/a11y/gtktoplevelaccessible.c deleted file mode 100644 index f010bea86e..0000000000 --- a/gtk/a11y/gtktoplevelaccessible.c +++ /dev/null @@ -1,253 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <stdlib.h> -#include <string.h> - -#include <gtk/gtkscrolledwindow.h> -#include <gtk/gtkframe.h> -#include <gtk/gtkbutton.h> -#include <gtk/gtkwindow.h> - -#include "gtktoplevelaccessible.h" - -struct _GtkToplevelAccessiblePrivate -{ - GList *window_list; -}; - -G_DEFINE_TYPE_WITH_PRIVATE (GtkToplevelAccessible, gtk_toplevel_accessible, ATK_TYPE_OBJECT) - -static void -gtk_toplevel_accessible_initialize (AtkObject *accessible, - gpointer data) -{ - ATK_OBJECT_CLASS (gtk_toplevel_accessible_parent_class)->initialize (accessible, data); - - accessible->role = ATK_ROLE_APPLICATION; - accessible->accessible_parent = NULL; -} - -static void -gtk_toplevel_accessible_object_finalize (GObject *obj) -{ - GtkToplevelAccessible *toplevel = GTK_TOPLEVEL_ACCESSIBLE (obj); - - if (toplevel->priv->window_list) - g_list_free (toplevel->priv->window_list); - - G_OBJECT_CLASS (gtk_toplevel_accessible_parent_class)->finalize (obj); -} - -static int -gtk_toplevel_accessible_get_n_children (AtkObject *obj) -{ - GtkToplevelAccessible *toplevel = GTK_TOPLEVEL_ACCESSIBLE (obj); - - return g_list_length (toplevel->priv->window_list); -} - -static AtkObject * -gtk_toplevel_accessible_ref_child (AtkObject *obj, - int i) -{ - GtkToplevelAccessible *toplevel; - GtkWidget *widget; - AtkObject *atk_obj; - - toplevel = GTK_TOPLEVEL_ACCESSIBLE (obj); - widget = g_list_nth_data (toplevel->priv->window_list, i); - if (!widget) - return NULL; - - atk_obj = gtk_widget_get_accessible (widget); - - g_object_ref (atk_obj); - - return atk_obj; -} - -static const char * -gtk_toplevel_accessible_get_name (AtkObject *obj) -{ - return g_get_prgname (); -} - -static void -gtk_toplevel_accessible_class_init (GtkToplevelAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS(klass); - GObjectClass *g_object_class = G_OBJECT_CLASS(klass); - - class->initialize = gtk_toplevel_accessible_initialize; - class->get_n_children = gtk_toplevel_accessible_get_n_children; - class->ref_child = gtk_toplevel_accessible_ref_child; - class->get_parent = NULL; - class->get_name = gtk_toplevel_accessible_get_name; - - g_object_class->finalize = gtk_toplevel_accessible_object_finalize; -} - -static void -remove_child (GtkToplevelAccessible *toplevel, - GtkWindow *window) -{ - AtkObject *atk_obj = ATK_OBJECT (toplevel); - GList *l; - guint window_count = 0; - AtkObject *child; - - if (toplevel->priv->window_list) - { - GtkWindow *tmp_window; - - for (l = toplevel->priv->window_list; l; l = l->next) - { - tmp_window = GTK_WINDOW (l->data); - - if (window == tmp_window) - { - /* Remove the window from the window_list & emit the signal */ - toplevel->priv->window_list = g_list_delete_link (toplevel->priv->window_list, l); - child = gtk_widget_get_accessible (GTK_WIDGET (window)); - g_signal_emit_by_name (atk_obj, "children-changed::remove", - window_count, child, NULL); - atk_object_set_parent (child, NULL); - break; - } - - window_count++; - } - } -} - -static gboolean -show_event_watcher (GSignalInvocationHint *ihint, - guint n_param_values, - const GValue *param_values, - gpointer data) -{ - GtkToplevelAccessible *toplevel = GTK_TOPLEVEL_ACCESSIBLE (data); - AtkObject *atk_obj = ATK_OBJECT (toplevel); - GObject *object; - GtkWidget *widget; - int n_children; - AtkObject *child; - - object = g_value_get_object (param_values + 0); - - if (!GTK_IS_WINDOW (object)) - return TRUE; - - widget = GTK_WIDGET (object); - if (gtk_widget_get_parent (widget)) - return TRUE; - - child = gtk_widget_get_accessible (widget); - if (atk_object_get_role (child) == ATK_ROLE_REDUNDANT_OBJECT || - atk_object_get_role (child) == ATK_ROLE_TOOL_TIP) - return TRUE; - - /* Add the window to the list & emit the signal */ - toplevel->priv->window_list = g_list_append (toplevel->priv->window_list, widget); - n_children = g_list_length (toplevel->priv->window_list); - - atk_object_set_parent (child, atk_obj); - g_signal_emit_by_name (atk_obj, "children-changed::add", - n_children - 1, child, NULL); - - g_signal_connect_swapped (G_OBJECT(object), "destroy", - G_CALLBACK (remove_child), toplevel); - - return TRUE; -} - -static gboolean -hide_event_watcher (GSignalInvocationHint *ihint, - guint n_param_values, - const GValue *param_values, - gpointer data) -{ - GtkToplevelAccessible *toplevel = GTK_TOPLEVEL_ACCESSIBLE (data); - GObject *object; - - object = g_value_get_object (param_values + 0); - - if (!GTK_IS_WINDOW (object)) - return TRUE; - - remove_child (toplevel, GTK_WINDOW (object)); - return TRUE; -} - -static void -gtk_toplevel_accessible_init (GtkToplevelAccessible *toplevel) -{ - GtkWindow *window; - GtkWidget *widget; - GList *l; - guint signal_id; - - toplevel->priv = gtk_toplevel_accessible_get_instance_private (toplevel); - - l = toplevel->priv->window_list = gtk_window_list_toplevels (); - - while (l) - { - window = GTK_WINDOW (l->data); - widget = GTK_WIDGET (window); - if (!window || - !gtk_widget_get_visible (widget) || - gtk_widget_get_parent (GTK_WIDGET (window))) - { - GList *temp_l = l->next; - - toplevel->priv->window_list = g_list_delete_link (toplevel->priv->window_list, l); - l = temp_l; - } - else - { - g_signal_connect_swapped (G_OBJECT (window), "destroy", - G_CALLBACK (remove_child), toplevel); - l = l->next; - } - } - - g_type_class_ref (GTK_TYPE_WINDOW); - - signal_id = g_signal_lookup ("show", GTK_TYPE_WINDOW); - g_signal_add_emission_hook (signal_id, 0, - show_event_watcher, toplevel, (GDestroyNotify) NULL); - - signal_id = g_signal_lookup ("hide", GTK_TYPE_WINDOW); - g_signal_add_emission_hook (signal_id, 0, - hide_event_watcher, toplevel, (GDestroyNotify) NULL); -} - -/** - * gtk_toplevel_accessible_get_children: - * - * Returns: (transfer none) (element-type Gtk.Window): List of - * children. - */ -GList * -gtk_toplevel_accessible_get_children (GtkToplevelAccessible *accessible) -{ - return accessible->priv->window_list; -} diff --git a/gtk/a11y/gtktoplevelaccessible.h b/gtk/a11y/gtktoplevelaccessible.h deleted file mode 100644 index 9c782b8a75..0000000000 --- a/gtk/a11y/gtktoplevelaccessible.h +++ /dev/null @@ -1,59 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_TOPLEVEL_ACCESSIBLE_H__ -#define __GTK_TOPLEVEL_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <atk/atk.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_TOPLEVEL_ACCESSIBLE (gtk_toplevel_accessible_get_type ()) -#define GTK_TOPLEVEL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOPLEVEL_ACCESSIBLE, GtkToplevelAccessible)) -#define GTK_TOPLEVEL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOPLEVEL_ACCESSIBLE, GtkToplevelAccessibleClass)) -#define GTK_IS_TOPLEVEL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOPLEVEL_ACCESSIBLE)) -#define GTK_IS_TOPLEVEL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOPLEVEL_ACCESSIBLE)) -#define GTK_TOPLEVEL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TOPLEVEL_ACCESSIBLE, GtkToplevelAccessibleClass)) - -typedef struct _GtkToplevelAccessible GtkToplevelAccessible; -typedef struct _GtkToplevelAccessibleClass GtkToplevelAccessibleClass; -typedef struct _GtkToplevelAccessiblePrivate GtkToplevelAccessiblePrivate; - -struct _GtkToplevelAccessible -{ - AtkObject parent; - - GtkToplevelAccessiblePrivate *priv; -}; - -struct _GtkToplevelAccessibleClass -{ - AtkObjectClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_toplevel_accessible_get_type (void); -GDK_AVAILABLE_IN_ALL -GList *gtk_toplevel_accessible_get_children (GtkToplevelAccessible *accessible); - -G_END_DECLS - -#endif /* __GTK_TOPLEVEL_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c deleted file mode 100644 index 5566939f8e..0000000000 --- a/gtk/a11y/gtktreeviewaccessible.c +++ /dev/null @@ -1,2084 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include <gtk/gtk.h> - -#include "gtktreeprivate.h" -#include "gtkwidgetprivate.h" - -#include "gtktreeviewaccessibleprivate.h" - -#include "gtkrenderercellaccessible.h" -#include "gtkbooleancellaccessible.h" -#include "gtkimagecellaccessible.h" -#include "gtkcontainercellaccessible.h" -#include "gtktextcellaccessible.h" -#include "gtkcellaccessibleparent.h" -#include "gtkcellaccessibleprivate.h" - -typedef struct -{ - GHashTable *cell_infos; -} GtkTreeViewAccessiblePrivate; - -typedef struct _GtkTreeViewAccessibleCellInfo GtkTreeViewAccessibleCellInfo; -struct _GtkTreeViewAccessibleCellInfo -{ - GtkCellAccessible *cell; - GtkTreeRBTree *tree; - GtkTreeRBNode *node; - GtkTreeViewColumn *cell_col_ref; - GtkTreeViewAccessible *view; -}; - -/* Misc */ - -static int cell_info_get_index (GtkTreeView *tree_view, - GtkTreeViewAccessibleCellInfo *info); -static gboolean is_cell_showing (GtkTreeView *tree_view, - GdkRectangle *cell_rect); - -static void cell_info_new (GtkTreeViewAccessible *accessible, - GtkTreeRBTree *tree, - GtkTreeRBNode *node, - GtkTreeViewColumn *tv_col, - GtkCellAccessible *cell); -static int get_column_number (GtkTreeView *tree_view, - GtkTreeViewColumn *column); - -static gboolean get_rbtree_column_from_index (GtkTreeView *tree_view, - int index, - GtkTreeRBTree **tree, - GtkTreeRBNode **node, - GtkTreeViewColumn **column); - -static GtkTreeViewAccessibleCellInfo* find_cell_info (GtkTreeViewAccessible *view, - GtkCellAccessible *cell); -static AtkObject * get_header_from_column (GtkTreeViewColumn *tv_col); - - -static void atk_table_interface_init (AtkTableIface *iface); -static void atk_selection_interface_init (AtkSelectionIface *iface); -static void atk_component_interface_init (AtkComponentIface *iface); -static void gtk_cell_accessible_parent_interface_init (GtkCellAccessibleParentIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkTreeViewAccessible, gtk_tree_view_accessible, GTK_TYPE_WIDGET_ACCESSIBLE, - G_ADD_PRIVATE (GtkTreeViewAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE, atk_table_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_ACCESSIBLE_PARENT, gtk_cell_accessible_parent_interface_init)) - - -static GQuark -gtk_tree_view_accessible_get_data_quark (void) -{ - static GQuark quark = 0; - - if (G_UNLIKELY (quark == 0)) - quark = g_quark_from_static_string ("gtk-tree-view-accessible-data"); - - return quark; -} - -static void -cell_info_free (GtkTreeViewAccessibleCellInfo *cell_info) -{ - gtk_accessible_set_widget (GTK_ACCESSIBLE (cell_info->cell), NULL); - g_object_unref (cell_info->cell); - - g_free (cell_info); -} - -static GtkTreePath * -cell_info_get_path (GtkTreeViewAccessibleCellInfo *cell_info) -{ - return _gtk_tree_path_new_from_rbtree (cell_info->tree, cell_info->node); -} - -static guint -cell_info_hash (gconstpointer info) -{ - const GtkTreeViewAccessibleCellInfo *cell_info = info; - guint node, col; - - node = GPOINTER_TO_UINT (cell_info->node); - col = GPOINTER_TO_UINT (cell_info->cell_col_ref); - - return ((node << sizeof (guint) / 2) | (node >> sizeof (guint) / 2)) ^ col; -} - -static gboolean -cell_info_equal (gconstpointer a, gconstpointer b) -{ - const GtkTreeViewAccessibleCellInfo *cell_info_a = a; - const GtkTreeViewAccessibleCellInfo *cell_info_b = b; - - return cell_info_a->node == cell_info_b->node && - cell_info_a->cell_col_ref == cell_info_b->cell_col_ref; -} - -static void -gtk_tree_view_accessible_initialize (AtkObject *obj, - gpointer data) -{ - GtkTreeViewAccessible *self = GTK_TREE_VIEW_ACCESSIBLE (obj); - GtkTreeViewAccessiblePrivate *priv = gtk_tree_view_accessible_get_instance_private (self); - GtkTreeView *tree_view = data; - GtkTreeModel *tree_model; - - ATK_OBJECT_CLASS (gtk_tree_view_accessible_parent_class)->initialize (obj, data); - - priv->cell_infos = g_hash_table_new_full (cell_info_hash, cell_info_equal, - NULL, - (GDestroyNotify) cell_info_free); - - tree_model = gtk_tree_view_get_model (tree_view); - - if (tree_model != NULL) - { - AtkRole role; - - if ((gtk_tree_model_get_flags (tree_model) & GTK_TREE_MODEL_LIST_ONLY) != 0) - role = ATK_ROLE_TABLE; - else - role = ATK_ROLE_TREE_TABLE; - - atk_object_set_role (obj, role); - } -} - -static void -gtk_tree_view_accessible_finalize (GObject *object) -{ - GtkTreeViewAccessible *self = GTK_TREE_VIEW_ACCESSIBLE (object); - GtkTreeViewAccessiblePrivate *priv = gtk_tree_view_accessible_get_instance_private (self); - - g_clear_pointer (&priv->cell_infos, g_hash_table_unref); - - G_OBJECT_CLASS (gtk_tree_view_accessible_parent_class)->finalize (object); -} - -void -gtk_tree_view_accessible_update_model (GtkTreeViewAccessible *self, - GtkTreeModel *model) -{ - GtkTreeViewAccessiblePrivate *priv = gtk_tree_view_accessible_get_instance_private (self); - - g_return_if_fail (GTK_IS_TREE_VIEW_ACCESSIBLE (self)); - g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model)); - - g_hash_table_remove_all (priv->cell_infos); - - if (model != NULL) - { - AtkObject *object = ATK_OBJECT (self); - AtkRole role; - - if ((gtk_tree_model_get_flags (model) & GTK_TREE_MODEL_LIST_ONLY) != 0) - role = ATK_ROLE_TABLE; - else - role = ATK_ROLE_TREE_TABLE; - - atk_object_set_role (object, role); - - g_object_freeze_notify (G_OBJECT (self)); - g_signal_emit_by_name (self, "model-changed"); - g_signal_emit_by_name (self, "visible-data-changed"); - g_object_thaw_notify (G_OBJECT (self)); - } -} - -static void -gtk_tree_view_accessible_widget_unset (GtkAccessible *gtkaccessible) -{ - GtkTreeViewAccessible *self = GTK_TREE_VIEW_ACCESSIBLE (gtkaccessible); - GtkTreeViewAccessiblePrivate *priv = gtk_tree_view_accessible_get_instance_private (self); - - g_hash_table_remove_all (priv->cell_infos); - - GTK_ACCESSIBLE_CLASS (gtk_tree_view_accessible_parent_class)->widget_unset (gtkaccessible); -} - -static int -get_n_rows (GtkTreeView *tree_view) -{ - GtkTreeRBTree *tree; - - tree = _gtk_tree_view_get_rbtree (tree_view); - - if (tree == NULL) - return 0; - - return tree->root->total_count; -} - -static int -get_n_columns (GtkTreeView *tree_view) -{ - guint i, visible_columns; - - visible_columns = 0; - - for (i = 0; i < gtk_tree_view_get_n_columns (tree_view); i++) - { - GtkTreeViewColumn *column = gtk_tree_view_get_column (tree_view, i); - - if (gtk_tree_view_column_get_visible (column)) - visible_columns++; - } - - return visible_columns; -} - -static int -gtk_tree_view_accessible_get_n_children (AtkObject *obj) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return 0; - - tree_view = GTK_TREE_VIEW (widget); - return (get_n_rows (tree_view) + 1) * get_n_columns (tree_view); -} - -static GtkTreeViewColumn * -get_visible_column (GtkTreeView *tree_view, - guint id) -{ - guint i; - - for (i = 0; i < gtk_tree_view_get_n_columns (tree_view); i++) - { - GtkTreeViewColumn *column = gtk_tree_view_get_column (tree_view, i); - - if (!gtk_tree_view_column_get_visible (column)) - continue; - - if (id == 0) - return column; - - id--; - } - - g_return_val_if_reached (NULL); -} - -static void -set_cell_data (GtkTreeView *treeview, - GtkTreeViewAccessible *accessible, - GtkCellAccessible *cell) -{ - GtkTreeViewAccessibleCellInfo *cell_info; - gboolean is_expander, is_expanded; - GtkTreeModel *model; - GtkTreeIter iter; - GtkTreePath *path; - - cell_info = find_cell_info (accessible, cell); - if (!cell_info) - return; - - model = gtk_tree_view_get_model (treeview); - - if (GTK_TREE_RBNODE_FLAG_SET (cell_info->node, GTK_TREE_RBNODE_IS_PARENT) && - cell_info->cell_col_ref == gtk_tree_view_get_expander_column (treeview)) - { - is_expander = TRUE; - is_expanded = cell_info->node->children != NULL; - } - else - { - is_expander = FALSE; - is_expanded = FALSE; - } - - path = cell_info_get_path (cell_info); - if (path == NULL || - !gtk_tree_model_get_iter (model, &iter, path)) - { - /* We only track valid cells, this should never happen */ - g_return_if_reached (); - } - gtk_tree_path_free (path); - - gtk_tree_view_column_cell_set_cell_data (cell_info->cell_col_ref, - model, - &iter, - is_expander, - is_expanded); -} - -static GtkCellAccessible * -peek_cell (GtkTreeViewAccessible *self, - GtkTreeRBTree *tree, - GtkTreeRBNode *node, - GtkTreeViewColumn *column) -{ - GtkTreeViewAccessiblePrivate *priv = gtk_tree_view_accessible_get_instance_private (self); - GtkTreeViewAccessibleCellInfo lookup, *cell_info; - - lookup.tree = tree; - lookup.node = node; - lookup.cell_col_ref = column; - - cell_info = g_hash_table_lookup (priv->cell_infos, &lookup); - if (cell_info == NULL) - return NULL; - - return cell_info->cell; -} - -static GtkCellAccessible * -create_cell_accessible_for_renderer (GtkCellRenderer *renderer, - GtkWidget *widget, - AtkObject *parent) -{ - GtkCellAccessible *cell; - - cell = GTK_CELL_ACCESSIBLE (gtk_renderer_cell_accessible_new (renderer)); - - _gtk_cell_accessible_initialize (cell, widget, parent); - - return cell; -} - -static GtkCellAccessible * -create_cell_accessible (GtkTreeView *treeview, - GtkTreeViewAccessible *accessible, - GtkTreeViewColumn *column) -{ - GList *renderer_list; - GList *l; - GtkCellAccessible *cell; - - renderer_list = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); - - /* If there is exactly one renderer in the list (which is a - * common case), shortcut and don't make a container - */ - if (g_list_length (renderer_list) == 1) - { - cell = create_cell_accessible_for_renderer (renderer_list->data, GTK_WIDGET (treeview), ATK_OBJECT (accessible)); - } - else - { - GtkContainerCellAccessible *container; - - container = gtk_container_cell_accessible_new (); - _gtk_cell_accessible_initialize (GTK_CELL_ACCESSIBLE (container), GTK_WIDGET (treeview), ATK_OBJECT (accessible)); - - for (l = renderer_list; l; l = l->next) - { - cell = create_cell_accessible_for_renderer (l->data, GTK_WIDGET (treeview), ATK_OBJECT (container)); - gtk_container_cell_accessible_add_child (container, cell); - } - - cell = GTK_CELL_ACCESSIBLE (container); - } - - g_list_free (renderer_list); - - return cell; -} - -static GtkCellAccessible * -create_cell (GtkTreeView *treeview, - GtkTreeViewAccessible *accessible, - GtkTreeRBTree *tree, - GtkTreeRBNode *node, - GtkTreeViewColumn *column) -{ - GtkCellAccessible *cell; - - cell = create_cell_accessible (treeview, accessible, column); - cell_info_new (accessible, tree, node, column, cell); - - set_cell_data (treeview, accessible, cell); - _gtk_cell_accessible_update_cache (cell, FALSE); - - return cell; -} - -static AtkObject * -gtk_tree_view_accessible_ref_child (AtkObject *obj, - int i) -{ - GtkWidget *widget; - GtkTreeViewAccessible *accessible; - GtkCellAccessible *cell; - GtkTreeView *tree_view; - GtkTreeViewColumn *tv_col; - GtkTreeRBTree *tree; - GtkTreeRBNode *node; - AtkObject *child; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - if (i >= gtk_tree_view_accessible_get_n_children (obj)) - return NULL; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (obj); - tree_view = GTK_TREE_VIEW (widget); - if (i < get_n_columns (tree_view)) - { - tv_col = get_visible_column (tree_view, i); - child = get_header_from_column (tv_col); - if (child) - g_object_ref (child); - return child; - } - - /* Find the RBTree and GtkTreeViewColumn for the index */ - if (!get_rbtree_column_from_index (tree_view, i, &tree, &node, &tv_col)) - return NULL; - - cell = peek_cell (accessible, tree, node, tv_col); - if (cell == NULL) - cell = create_cell (tree_view, accessible, tree, node, tv_col); - - return (AtkObject *) g_object_ref (cell); -} - -static AtkStateSet* -gtk_tree_view_accessible_ref_state_set (AtkObject *obj) -{ - AtkStateSet *state_set; - GtkWidget *widget; - - state_set = ATK_OBJECT_CLASS (gtk_tree_view_accessible_parent_class)->ref_state_set (obj); - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - - if (widget != NULL) - atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS); - - return state_set; -} - -static void -gtk_tree_view_accessible_class_init (GtkTreeViewAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GtkAccessibleClass *accessible_class = (GtkAccessibleClass*)klass; - - class->get_n_children = gtk_tree_view_accessible_get_n_children; - class->ref_child = gtk_tree_view_accessible_ref_child; - class->ref_state_set = gtk_tree_view_accessible_ref_state_set; - class->initialize = gtk_tree_view_accessible_initialize; - - accessible_class->widget_unset = gtk_tree_view_accessible_widget_unset; - - gobject_class->finalize = gtk_tree_view_accessible_finalize; -} - -static void -gtk_tree_view_accessible_init (GtkTreeViewAccessible *view) -{ -} - -/* atkcomponent.h */ - -static AtkObject * -gtk_tree_view_accessible_ref_accessible_at_point (AtkComponent *component, - int x, - int y, - AtkCoordType coord_type) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - GtkTreePath *path; - GtkTreeViewColumn *column; - int x_pos, y_pos; - int bx, by; - GtkCellAccessible *cell; - GtkTreeRBTree *tree; - GtkTreeRBNode *node; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (widget == NULL) - return NULL; - - tree_view = GTK_TREE_VIEW (widget); - - atk_component_get_extents (component, &x_pos, &y_pos, NULL, NULL, coord_type); - gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &bx, &by); - if (!gtk_tree_view_get_path_at_pos (tree_view, - bx - x_pos, by - y_pos, - &path, &column, NULL, NULL)) - return NULL; - - if (_gtk_tree_view_find_node (tree_view, path, &tree, &node)) - { - gtk_tree_path_free (path); - return NULL; - } - - cell = peek_cell (GTK_TREE_VIEW_ACCESSIBLE (component), tree, node, column); - if (cell == NULL) - cell = create_cell (tree_view, GTK_TREE_VIEW_ACCESSIBLE (component), tree, node, column); - - return (AtkObject *) g_object_ref (cell); -} - -static void -atk_component_interface_init (AtkComponentIface *iface) -{ - iface->ref_accessible_at_point = gtk_tree_view_accessible_ref_accessible_at_point; -} - -/* atktable.h */ - -static int -gtk_tree_view_accessible_get_index_at (AtkTable *table, - int row, - int column) -{ - GtkWidget *widget; - int n_cols, n_rows; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - return -1; - - n_cols = atk_table_get_n_columns (table); - n_rows = atk_table_get_n_rows (table); - - if (row >= n_rows || column >= n_cols) - return -1; - - return (row + 1) * n_cols + column; -} - -static int -gtk_tree_view_accessible_get_column_at_index (AtkTable *table, - int index) -{ - GtkWidget *widget; - int n_columns; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - return -1; - - if (index >= gtk_tree_view_accessible_get_n_children (ATK_OBJECT (table))) - return -1; - - n_columns = get_n_columns (GTK_TREE_VIEW (widget)); - - /* checked by the n_children() check above */ - g_assert (n_columns > 0); - - return index % n_columns; -} - -static int -gtk_tree_view_accessible_get_row_at_index (AtkTable *table, - int index) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - return -1; - - tree_view = GTK_TREE_VIEW (widget); - - index /= get_n_columns (tree_view); - index--; - if (index >= get_n_rows (tree_view)) - return -1; - - return index; -} - -static AtkObject * -gtk_tree_view_accessible_table_ref_at (AtkTable *table, - int row, - int column) -{ - int index; - - index = gtk_tree_view_accessible_get_index_at (table, row, column); - if (index == -1) - return NULL; - - return gtk_tree_view_accessible_ref_child (ATK_OBJECT (table), index); -} - -static int -gtk_tree_view_accessible_get_n_rows (AtkTable *table) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - return 0; - - return get_n_rows (GTK_TREE_VIEW (widget)); -} - -static int -gtk_tree_view_accessible_get_n_columns (AtkTable *table) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - return 0; - - return get_n_columns (GTK_TREE_VIEW (widget)); -} - -static gboolean -gtk_tree_view_accessible_is_row_selected (AtkTable *table, - int row) -{ - GtkWidget *widget; - GtkTreeRBTree *tree; - GtkTreeRBNode *node; - - if (row < 0) - return FALSE; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - return FALSE; - - if (!gtk_tree_rbtree_find_index (_gtk_tree_view_get_rbtree (GTK_TREE_VIEW (widget)), - row, - &tree, - &node)) - return FALSE; - - return GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED); -} - -static gboolean -gtk_tree_view_accessible_is_selected (AtkTable *table, - int row, - int column) -{ - return gtk_tree_view_accessible_is_row_selected (table, row); -} - -typedef struct { - GArray *array; - GtkTreeView *treeview; -} SelectedRowsData; - -static void -get_selected_rows (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer datap) -{ - SelectedRowsData *data = datap; - GtkTreeRBTree *tree; - GtkTreeRBNode *node; - int id; - - if (_gtk_tree_view_find_node (data->treeview, - path, - &tree, &node)) - { - g_assert_not_reached (); - } - - id = gtk_tree_rbtree_node_get_index (tree, node); - - g_array_append_val (data->array, id); -} - -static int -gtk_tree_view_accessible_get_selected_rows (AtkTable *table, - int **rows_selected) -{ - SelectedRowsData data; - GtkWidget *widget; - int n_rows; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - { - if (rows_selected != NULL) - *rows_selected = NULL; - return 0; - } - - data.treeview = GTK_TREE_VIEW (widget); - data.array = g_array_new (FALSE, FALSE, sizeof (int)); - - gtk_tree_selection_selected_foreach (gtk_tree_view_get_selection (data.treeview), - get_selected_rows, - &data); - - n_rows = data.array->len; - if (rows_selected) - *rows_selected = (int *) g_array_free (data.array, FALSE); - else - g_array_free (data.array, TRUE); - - return n_rows; -} - -static gboolean -gtk_tree_view_accessible_add_row_selection (AtkTable *table, - int row) -{ - GtkTreeView *treeview; - GtkTreePath *path; - GtkTreeRBTree *tree; - GtkTreeRBNode *node; - - if (row < 0) - return FALSE; - - treeview = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (table))); - if (treeview == NULL) - return FALSE; - - if (!gtk_tree_rbtree_find_index (_gtk_tree_view_get_rbtree (treeview), - row, - &tree, - &node)) - return FALSE; - - if (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED)) - return FALSE; - - path = _gtk_tree_path_new_from_rbtree (tree, node); - gtk_tree_selection_select_path (gtk_tree_view_get_selection (treeview), path); - gtk_tree_path_free (path); - - return TRUE; -} - -static gboolean -gtk_tree_view_accessible_remove_row_selection (AtkTable *table, - int row) -{ - GtkTreeView *treeview; - GtkTreePath *path; - GtkTreeRBTree *tree; - GtkTreeRBNode *node; - - if (row < 0) - return FALSE; - - treeview = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (table))); - if (treeview == NULL) - return FALSE; - - if (!gtk_tree_rbtree_find_index (_gtk_tree_view_get_rbtree (treeview), - row, - &tree, - &node)) - return FALSE; - - if (!GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED)) - return FALSE; - - path = _gtk_tree_path_new_from_rbtree (tree, node); - gtk_tree_selection_unselect_path (gtk_tree_view_get_selection (treeview), path); - gtk_tree_path_free (path); - - return TRUE; -} - -static AtkObject * -gtk_tree_view_accessible_get_column_header (AtkTable *table, - int in_col) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - GtkTreeViewColumn *tv_col; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - return NULL; - - tree_view = GTK_TREE_VIEW (widget); - if (in_col < 0 || in_col >= get_n_columns (tree_view)) - return NULL; - - tv_col = get_visible_column (tree_view, in_col); - return get_header_from_column (tv_col); -} - -static const char * -gtk_tree_view_accessible_get_column_description (AtkTable *table, - int in_col) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - GtkTreeViewColumn *tv_col; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (table)); - if (widget == NULL) - return NULL; - - tree_view = GTK_TREE_VIEW (widget); - if (in_col < 0 || in_col >= get_n_columns (tree_view)) - return NULL; - - tv_col = get_visible_column (tree_view, in_col); - return gtk_tree_view_column_get_title (tv_col); -} - -static void -atk_table_interface_init (AtkTableIface *iface) -{ - iface->ref_at = gtk_tree_view_accessible_table_ref_at; - iface->get_n_rows = gtk_tree_view_accessible_get_n_rows; - iface->get_n_columns = gtk_tree_view_accessible_get_n_columns; - iface->get_index_at = gtk_tree_view_accessible_get_index_at; - iface->get_column_at_index = gtk_tree_view_accessible_get_column_at_index; - iface->get_row_at_index = gtk_tree_view_accessible_get_row_at_index; - iface->is_row_selected = gtk_tree_view_accessible_is_row_selected; - iface->is_selected = gtk_tree_view_accessible_is_selected; - iface->get_selected_rows = gtk_tree_view_accessible_get_selected_rows; - iface->add_row_selection = gtk_tree_view_accessible_add_row_selection; - iface->remove_row_selection = gtk_tree_view_accessible_remove_row_selection; - iface->get_column_extent_at = NULL; - iface->get_row_extent_at = NULL; - iface->get_column_header = gtk_tree_view_accessible_get_column_header; - iface->get_column_description = gtk_tree_view_accessible_get_column_description; -} - -/* atkselection.h */ - -static gboolean -gtk_tree_view_accessible_add_selection (AtkSelection *selection, - int i) -{ - AtkTable *table; - int n_columns; - int row; - - table = ATK_TABLE (selection); - n_columns = gtk_tree_view_accessible_get_n_columns (table); - if (n_columns != 1) - return FALSE; - - row = gtk_tree_view_accessible_get_row_at_index (table, i); - return gtk_tree_view_accessible_add_row_selection (table, row); -} - -static gboolean -gtk_tree_view_accessible_clear_selection (AtkSelection *selection) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - GtkTreeSelection *tree_selection; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - tree_view = GTK_TREE_VIEW (widget); - tree_selection = gtk_tree_view_get_selection (tree_view); - - gtk_tree_selection_unselect_all (tree_selection); - return TRUE; -} - -static AtkObject * -gtk_tree_view_accessible_ref_selection (AtkSelection *selection, - int i) -{ - AtkTable *table; - int row; - int n_selected; - int n_columns; - int *selected; - - table = ATK_TABLE (selection); - n_columns = gtk_tree_view_accessible_get_n_columns (table); - n_selected = gtk_tree_view_accessible_get_selected_rows (table, &selected); - if (n_columns == 0 || i >= n_columns * n_selected) - return NULL; - - row = selected[i / n_columns]; - g_free (selected); - - return gtk_tree_view_accessible_table_ref_at (table, row, i % n_columns); -} - -static int -gtk_tree_view_accessible_get_selection_count (AtkSelection *selection) -{ - AtkTable *table; - int n_selected; - - table = ATK_TABLE (selection); - n_selected = gtk_tree_view_accessible_get_selected_rows (table, NULL); - if (n_selected > 0) - n_selected *= gtk_tree_view_accessible_get_n_columns (table); - return n_selected; -} - -static gboolean -gtk_tree_view_accessible_is_child_selected (AtkSelection *selection, - int i) -{ - GtkWidget *widget; - int row; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection)); - if (widget == NULL) - return FALSE; - - row = gtk_tree_view_accessible_get_row_at_index (ATK_TABLE (selection), i); - - return gtk_tree_view_accessible_is_row_selected (ATK_TABLE (selection), row); -} - -static void atk_selection_interface_init (AtkSelectionIface *iface) -{ - iface->add_selection = gtk_tree_view_accessible_add_selection; - iface->clear_selection = gtk_tree_view_accessible_clear_selection; - iface->ref_selection = gtk_tree_view_accessible_ref_selection; - iface->get_selection_count = gtk_tree_view_accessible_get_selection_count; - iface->is_child_selected = gtk_tree_view_accessible_is_child_selected; -} - -#define EXTRA_EXPANDER_PADDING 4 - -static void -gtk_tree_view_accessible_get_cell_area (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - GdkRectangle *cell_rect) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - GtkTreeViewColumn *tv_col; - GtkTreePath *path; - AtkObject *parent_cell; - GtkTreeViewAccessibleCellInfo *cell_info; - GtkCellAccessible *top_cell; - - /* Default value. */ - cell_rect->x = 0; - cell_rect->y = 0; - cell_rect->width = 0; - cell_rect->height = 0; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); - if (widget == NULL) - return; - - tree_view = GTK_TREE_VIEW (widget); - parent_cell = atk_object_get_parent (ATK_OBJECT (cell)); - if (parent_cell != ATK_OBJECT (parent)) - top_cell = GTK_CELL_ACCESSIBLE (parent_cell); - else - top_cell = cell; - cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), top_cell); - if (!cell_info) - return; - path = cell_info_get_path (cell_info); - tv_col = cell_info->cell_col_ref; - if (path) - { - GtkTreeViewColumn *expander_column; - - gtk_tree_view_get_cell_area (tree_view, path, tv_col, cell_rect); - expander_column = gtk_tree_view_get_expander_column (tree_view); - if (expander_column == tv_col) - { - /* Values from gtktreeview.c ... */ -#define _TREE_VIEW_EXPANDER_SIZE 16 -#define _TREE_VIEW_HORIZONTAL_SEPARATOR 4 - int expander_size = _TREE_VIEW_EXPANDER_SIZE + (_TREE_VIEW_HORIZONTAL_SEPARATOR / 2); - cell_rect->x += expander_size + EXTRA_EXPANDER_PADDING; - cell_rect->width -= expander_size + EXTRA_EXPANDER_PADDING; - } - - gtk_tree_path_free (path); - - /* A column has more than one renderer so we find the position - * and width of each - */ - if (top_cell != cell) - { - int cell_index; - gboolean found; - int cell_start; - int cell_width; - GList *renderers; - GtkCellRenderer *renderer; - - cell_index = atk_object_get_index_in_parent (ATK_OBJECT (cell)); - renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tv_col)); - renderer = g_list_nth_data (renderers, cell_index); - - found = gtk_tree_view_column_cell_get_position (tv_col, renderer, &cell_start, &cell_width); - if (found) - { - cell_rect->x += cell_start; - cell_rect->width = cell_width; - } - g_list_free (renderers); - } - - } -} - -static void -gtk_tree_view_accessible_get_cell_extents (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - GdkRectangle cell_rect; - int w_x, w_y; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); - if (widget == NULL) - return; - - tree_view = GTK_TREE_VIEW (widget); - gtk_tree_view_accessible_get_cell_area (parent, cell, &cell_rect); - gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, - 0, 0, - &w_x, &w_y); - - *width = cell_rect.width; - *height = cell_rect.height; - if (is_cell_showing (tree_view, &cell_rect)) - { - *x = cell_rect.x + w_x; - *y = cell_rect.y + w_y; - } - else - { - *x = G_MININT; - *y = G_MININT; - } -} - -static gboolean -gtk_tree_view_accessible_grab_cell_focus (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - GtkTreeViewColumn *tv_col; - GtkTreePath *path; - AtkObject *parent_cell; - AtkObject *cell_object; - GtkTreeViewAccessibleCellInfo *cell_info; - GtkCellRenderer *renderer = NULL; - GtkWidget *toplevel; - int index; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); - if (widget == NULL) - return FALSE; - - tree_view = GTK_TREE_VIEW (widget); - - cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), cell); - if (!cell_info) - return FALSE; - cell_object = ATK_OBJECT (cell); - parent_cell = atk_object_get_parent (cell_object); - tv_col = cell_info->cell_col_ref; - if (parent_cell != ATK_OBJECT (parent)) - { - /* GtkCellAccessible is in a GtkContainerCellAccessible. - * The GtkTreeViewColumn has multiple renderers; - * find the corresponding one. - */ - GList *renderers; - - renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tv_col)); - index = atk_object_get_index_in_parent (cell_object); - renderer = g_list_nth_data (renderers, index); - g_list_free (renderers); - } - path = cell_info_get_path (cell_info); - if (path) - { - if (renderer) - gtk_tree_view_set_cursor_on_cell (tree_view, path, tv_col, renderer, FALSE); - else - gtk_tree_view_set_cursor (tree_view, path, tv_col, FALSE); - - gtk_tree_path_free (path); - gtk_widget_grab_focus (widget); - toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); - if (GTK_IS_WINDOW (toplevel)) - { - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_window_present (GTK_WINDOW (toplevel)); - G_GNUC_END_IGNORE_DEPRECATIONS - } - - return TRUE; - } - else - return FALSE; -} - -static int -gtk_tree_view_accessible_get_child_index (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkTreeViewAccessibleCellInfo *cell_info; - GtkTreeView *tree_view; - - cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), cell); - if (!cell_info) - return -1; - - tree_view = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (parent))); - - return cell_info_get_index (tree_view, cell_info); -} - -static GtkCellRendererState -gtk_tree_view_accessible_get_renderer_state (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkTreeViewAccessibleCellInfo *cell_info; - GtkTreeView *treeview; - GtkCellRendererState flags; - - cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), cell); - if (!cell_info) - return 0; - - flags = 0; - - if (GTK_TREE_RBNODE_FLAG_SET (cell_info->node, GTK_TREE_RBNODE_IS_SELECTED)) - flags |= GTK_CELL_RENDERER_SELECTED; - - if (GTK_TREE_RBNODE_FLAG_SET (cell_info->node, GTK_TREE_RBNODE_IS_PRELIT)) - flags |= GTK_CELL_RENDERER_PRELIT; - - if (gtk_tree_view_column_get_sort_indicator (cell_info->cell_col_ref)) - flags |= GTK_CELL_RENDERER_SORTED; - - treeview = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (parent))); - - if (cell_info->cell_col_ref == gtk_tree_view_get_expander_column (treeview)) - { - if (GTK_TREE_RBNODE_FLAG_SET (cell_info->node, GTK_TREE_RBNODE_IS_PARENT)) - flags |= GTK_CELL_RENDERER_EXPANDABLE; - - if (cell_info->node->children) - flags |= GTK_CELL_RENDERER_EXPANDED; - } - - if (gtk_widget_has_focus (GTK_WIDGET (treeview))) - { - GtkTreeViewColumn *column; - GtkTreePath *path; - GtkTreeRBTree *tree; - GtkTreeRBNode *node = NULL; - - gtk_tree_view_get_cursor (treeview, &path, &column); - if (path) - { - _gtk_tree_view_find_node (treeview, path, &tree, &node); - gtk_tree_path_free (path); - } - else - tree = NULL; - - if (cell_info->cell_col_ref == column - && cell_info->tree == tree - && cell_info->node == node) - flags |= GTK_CELL_RENDERER_FOCUSED; - } - - return flags; -} - -static void -gtk_tree_view_accessible_expand_collapse (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkTreeViewAccessibleCellInfo *cell_info; - GtkTreeView *treeview; - GtkTreePath *path; - - treeview = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (parent))); - - cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), cell); - if (!cell_info || - cell_info->cell_col_ref != gtk_tree_view_get_expander_column (treeview)) - return; - - path = cell_info_get_path (cell_info); - - if (cell_info->node->children) - gtk_tree_view_collapse_row (treeview, path); - else - gtk_tree_view_expand_row (treeview, path, FALSE); - - gtk_tree_path_free (path); -} - -static void -gtk_tree_view_accessible_activate (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkTreeViewAccessibleCellInfo *cell_info; - GtkTreeView *treeview; - GtkTreePath *path; - - treeview = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (parent))); - - cell_info = find_cell_info (GTK_TREE_VIEW_ACCESSIBLE (parent), cell); - if (!cell_info) - return; - - path = cell_info_get_path (cell_info); - - gtk_tree_view_row_activated (treeview, path, cell_info->cell_col_ref); - - gtk_tree_path_free (path); -} - -static void -gtk_tree_view_accessible_edit (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkTreeView *treeview; - - if (!gtk_tree_view_accessible_grab_cell_focus (parent, cell)) - return; - - treeview = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (parent))); - - g_signal_emit_by_name (treeview, - "real-select-cursor-row", - TRUE); -} - -static void -gtk_tree_view_accessible_update_relationset (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - AtkRelationSet *relationset) -{ - GtkTreeViewAccessibleCellInfo *cell_info; - GtkTreeViewAccessible *accessible; - GtkTreeViewColumn *column; - GtkTreeView *treeview; - AtkRelation *relation; - GtkTreeRBTree *tree; - GtkTreeRBNode *node; - AtkObject *object; - - /* Don't set relations on cells that aren't direct descendants of the treeview. - * So only set it on the container, not on the renderer accessibles */ - if (atk_object_get_parent (ATK_OBJECT (cell)) != ATK_OBJECT (parent)) - return; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (parent); - cell_info = find_cell_info (accessible, cell); - if (!cell_info) - return; - - /* only set parent/child rows on the expander column */ - treeview = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (parent))); - column = gtk_tree_view_get_expander_column (treeview); - if (column != cell_info->cell_col_ref) - return; - - /* Update CHILD_OF relation to parent cell */ - relation = atk_relation_set_get_relation_by_type (relationset, ATK_RELATION_NODE_CHILD_OF); - if (relation) - atk_relation_set_remove (relationset, relation); - - if (cell_info->tree->parent_tree) - { - object = ATK_OBJECT (peek_cell (accessible, cell_info->tree->parent_tree, cell_info->tree->parent_node, column)); - if (object == NULL) - object = ATK_OBJECT (create_cell (treeview, accessible, cell_info->tree->parent_tree, cell_info->tree->parent_node, column)); - } - else - object = ATK_OBJECT (accessible); - - atk_relation_set_add_relation_by_type (relationset, ATK_RELATION_NODE_CHILD_OF, object); - - /* Update PARENT_OF relation for all child cells */ - relation = atk_relation_set_get_relation_by_type (relationset, ATK_RELATION_NODE_PARENT_OF); - if (relation) - atk_relation_set_remove (relationset, relation); - - tree = cell_info->node->children; - if (tree) - { - for (node = gtk_tree_rbtree_first (tree); - node != NULL; - node = gtk_tree_rbtree_next (tree, node)) - { - object = ATK_OBJECT (peek_cell (accessible, tree, node, column)); - if (object == NULL) - object = ATK_OBJECT (create_cell (treeview, accessible, tree, node, column)); - - atk_relation_set_add_relation_by_type (relationset, ATK_RELATION_NODE_PARENT_OF, ATK_OBJECT (object)); - } - } -} - -static void -gtk_tree_view_accessible_get_cell_position (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell, - int *row, - int *column) -{ - GtkWidget *widget; - GtkTreeView *tree_view; - GtkTreeViewAccessibleCellInfo *cell_info; - GtkTreeViewAccessible *accessible; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); - if (widget == NULL) - return; - - tree_view = GTK_TREE_VIEW (widget); - accessible = GTK_TREE_VIEW_ACCESSIBLE (parent); - cell_info = find_cell_info (accessible, cell); - if (!cell_info) - return; - - if (row) - (*row) = gtk_tree_rbtree_node_get_index (cell_info->tree, cell_info->node); - if (column) - (*column) = get_column_number (tree_view, cell_info->cell_col_ref); -} - -static GPtrArray * -gtk_tree_view_accessible_get_column_header_cells (GtkCellAccessibleParent *parent, - GtkCellAccessible *cell) -{ - GtkWidget *widget; - GtkTreeViewAccessibleCellInfo *cell_info; - GtkTreeViewAccessible *accessible; - GPtrArray *array; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); - if (widget == NULL) - return NULL; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (parent); - cell_info = find_cell_info (accessible, cell); - if (!cell_info) - return NULL; - - array = g_ptr_array_new_full (1, g_object_unref); - g_ptr_array_add (array, g_object_ref (get_header_from_column ( (cell_info->cell_col_ref)))); - return array; -} - -static void -gtk_cell_accessible_parent_interface_init (GtkCellAccessibleParentIface *iface) -{ - iface->get_cell_extents = gtk_tree_view_accessible_get_cell_extents; - iface->get_cell_area = gtk_tree_view_accessible_get_cell_area; - iface->grab_focus = gtk_tree_view_accessible_grab_cell_focus; - iface->get_child_index = gtk_tree_view_accessible_get_child_index; - iface->get_renderer_state = gtk_tree_view_accessible_get_renderer_state; - iface->expand_collapse = gtk_tree_view_accessible_expand_collapse; - iface->activate = gtk_tree_view_accessible_activate; - iface->edit = gtk_tree_view_accessible_edit; - iface->update_relationset = gtk_tree_view_accessible_update_relationset; - iface->get_cell_position = gtk_tree_view_accessible_get_cell_position; - iface->get_column_header_cells = gtk_tree_view_accessible_get_column_header_cells; -} - -void -_gtk_tree_view_accessible_reorder (GtkTreeView *treeview) -{ - GtkTreeViewAccessible *accessible; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (treeview))); - if (accessible == NULL) - return; - - g_signal_emit_by_name (accessible, "row-reordered"); -} - -static gboolean -is_cell_showing (GtkTreeView *tree_view, - GdkRectangle *cell_rect) -{ - GdkRectangle rect, *visible_rect; - GdkRectangle rect1, *tree_cell_rect; - int bx, by; - gboolean is_showing; - - /* A cell is considered "SHOWING" if any part of the cell is - * in the visible area. Other ways we could do this is by a - * cell's midpoint or if the cell is fully in the visible range. - * Since we have the cell_rect x, y, width, height of the cell, - * any of these is easy to compute. - * - * It is assumed that cell's rectangle is in widget coordinates - * so we must transform to tree cordinates. - */ - visible_rect = ▭ - tree_cell_rect = &rect1; - tree_cell_rect->x = cell_rect->x; - tree_cell_rect->y = cell_rect->y; - tree_cell_rect->width = cell_rect->width; - tree_cell_rect->height = cell_rect->height; - - gtk_tree_view_get_visible_rect (tree_view, visible_rect); - gtk_tree_view_convert_tree_to_bin_window_coords (tree_view, visible_rect->x, - visible_rect->y, &bx, &by); - - if (((tree_cell_rect->x + tree_cell_rect->width) < bx) || - ((tree_cell_rect->y + tree_cell_rect->height) < by) || - (tree_cell_rect->x > (bx + visible_rect->width)) || - (tree_cell_rect->y > (by + visible_rect->height))) - is_showing = FALSE; - else - is_showing = TRUE; - - return is_showing; -} - -/* Misc Private */ - -static int -cell_info_get_index (GtkTreeView *tree_view, - GtkTreeViewAccessibleCellInfo *info) -{ - int index; - - index = gtk_tree_rbtree_node_get_index (info->tree, info->node) + 1; - index *= get_n_columns (tree_view); - index += get_column_number (tree_view, info->cell_col_ref); - - return index; -} - -static void -cell_info_new (GtkTreeViewAccessible *self, - GtkTreeRBTree *tree, - GtkTreeRBNode *node, - GtkTreeViewColumn *tv_col, - GtkCellAccessible *cell) -{ - GtkTreeViewAccessiblePrivate *priv = gtk_tree_view_accessible_get_instance_private (self); - GtkTreeViewAccessibleCellInfo *cell_info; - - cell_info = g_new (GtkTreeViewAccessibleCellInfo, 1); - - cell_info->view = self; - cell_info->tree = tree; - cell_info->node = node; - cell_info->cell_col_ref = tv_col; - cell_info->cell = cell; - - g_object_set_qdata (G_OBJECT (cell), - gtk_tree_view_accessible_get_data_quark (), - cell_info); - - g_hash_table_replace (priv->cell_infos, cell_info, cell_info); -} - -/* Returns the column number of the specified GtkTreeViewColumn - * The column must be visible. - */ -static int -get_column_number (GtkTreeView *treeview, - GtkTreeViewColumn *column) -{ - GtkTreeViewColumn *cur; - guint i, number; - - number = 0; - - for (i = 0; i < gtk_tree_view_get_n_columns (treeview); i++) - { - cur = gtk_tree_view_get_column (treeview, i); - - if (!gtk_tree_view_column_get_visible (cur)) - continue; - - if (cur == column) - break; - - number++; - } - - g_return_val_if_fail (i < gtk_tree_view_get_n_columns (treeview), 0); - - return number; -} - -static gboolean -get_rbtree_column_from_index (GtkTreeView *tree_view, - int index, - GtkTreeRBTree **tree, - GtkTreeRBNode **node, - GtkTreeViewColumn **column) -{ - guint n_columns = get_n_columns (tree_view); - - if (n_columns == 0) - return FALSE; - /* First row is the column headers */ - index -= n_columns; - if (index < 0) - return FALSE; - - if (tree) - { - g_return_val_if_fail (node != NULL, FALSE); - - if (!gtk_tree_rbtree_find_index (_gtk_tree_view_get_rbtree (tree_view), - index / n_columns, - tree, - node)) - return FALSE; - } - - if (column) - { - *column = get_visible_column (tree_view, index % n_columns); - if (*column == NULL) - return FALSE; - } - return TRUE; -} - -static GtkTreeViewAccessibleCellInfo * -find_cell_info (GtkTreeViewAccessible *accessible, - GtkCellAccessible *cell) -{ - AtkObject *parent; - - parent = atk_object_get_parent (ATK_OBJECT (cell)); - while (parent != ATK_OBJECT (accessible)) - { - cell = GTK_CELL_ACCESSIBLE (parent); - parent = atk_object_get_parent (ATK_OBJECT (cell)); - } - - return g_object_get_qdata (G_OBJECT (cell), - gtk_tree_view_accessible_get_data_quark ()); -} - -static AtkObject * -get_header_from_column (GtkTreeViewColumn *tv_col) -{ - AtkObject *rc; - GtkWidget *header_widget; - - if (tv_col == NULL) - return NULL; - - header_widget = gtk_tree_view_column_get_button (tv_col); - - if (header_widget) - rc = gtk_widget_get_accessible (header_widget); - else - rc = NULL; - - return rc; -} - -void -_gtk_tree_view_accessible_add (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node) -{ - GtkTreeViewAccessible *accessible; - guint row, n_rows, n_cols, i; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (treeview))); - if (accessible == NULL) - return; - - if (node == NULL) - { - row = tree->parent_tree ? gtk_tree_rbtree_node_get_index (tree->parent_tree, tree->parent_node) : 0; - n_rows = tree->root->total_count; - } - else - { - row = gtk_tree_rbtree_node_get_index (tree, node); - n_rows = 1 + (node->children ? node->children->root->total_count : 0); - } - - g_signal_emit_by_name (accessible, "row-inserted", row, n_rows); - - n_cols = get_n_columns (treeview); - if (n_cols) - { - for (i = (row + 1) * n_cols; i < (row + n_rows + 1) * n_cols; i++) - { - /* Pass NULL as the child object, i.e. 4th argument */ - g_signal_emit_by_name (accessible, "children-changed::add", i, NULL, NULL); - } - } -} - -void -_gtk_tree_view_accessible_remove (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node) -{ - GtkTreeViewAccessibleCellInfo *cell_info; - GHashTableIter iter; - GtkTreeViewAccessible *accessible; - GtkTreeViewAccessiblePrivate *priv; - guint row, n_rows, n_cols, i; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (treeview))); - if (accessible == NULL) - return; - - priv = gtk_tree_view_accessible_get_instance_private (accessible); - - /* if this shows up in profiles, special-case node->children == NULL */ - - if (node == NULL) - { - row = tree->parent_tree ? gtk_tree_rbtree_node_get_index (tree->parent_tree, tree->parent_node) : 0; - n_rows = tree->root->total_count + 1; - } - else - { - row = gtk_tree_rbtree_node_get_index (tree, node); - n_rows = 1 + (node->children ? node->children->root->total_count : 0); - - tree = node->children; - } - - g_signal_emit_by_name (accessible, "row-deleted", row, n_rows); - - n_cols = get_n_columns (treeview); - if (n_cols) - { - for (i = (n_rows + row + 1) * n_cols - 1; i >= (row + 1) * n_cols; i--) - { - /* Pass NULL as the child object, i.e. 4th argument */ - g_signal_emit_by_name (accessible, "children-changed::remove", i, NULL, NULL); - } - - g_hash_table_iter_init (&iter, priv->cell_infos); - while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&cell_info)) - { - if (node == cell_info->node || - tree == cell_info->tree || - (tree && gtk_tree_rbtree_contains (tree, cell_info->tree))) - g_hash_table_iter_remove (&iter); - } - } -} - -void -_gtk_tree_view_accessible_changed (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node) -{ - GtkTreeViewAccessible *accessible; - guint i; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (treeview))); - if (accessible == NULL) - return; - - for (i = 0; i < gtk_tree_view_get_n_columns (treeview); i++) - { - GtkCellAccessible *cell = peek_cell (accessible, - tree, node, - gtk_tree_view_get_column (treeview, i)); - - if (cell == NULL) - continue; - - set_cell_data (treeview, accessible, cell); - _gtk_cell_accessible_update_cache (cell, TRUE); - } - - g_signal_emit_by_name (accessible, "visible-data-changed"); -} - -/* NB: id is not checked, only columns < id are. - * This is important so the function works for notification of removal of a column */ -static guint -to_visible_column_id (GtkTreeView *treeview, - guint id) -{ - guint i; - guint invisible; - - invisible = 0; - - for (i = 0; i < id; i++) - { - GtkTreeViewColumn *column = gtk_tree_view_get_column (treeview, i); - - if (!gtk_tree_view_column_get_visible (column)) - invisible++; - } - - return id - invisible; -} - -static void -gtk_tree_view_accessible_do_add_column (GtkTreeViewAccessible *accessible, - GtkTreeView *treeview, - GtkTreeViewColumn *column, - guint id) -{ - guint row, n_rows, n_cols; - - /* Generate column-inserted signal */ - g_signal_emit_by_name (accessible, "column-inserted", id, 1); - - n_rows = get_n_rows (treeview); - n_cols = get_n_columns (treeview); - - /* Generate children-changed signals */ - for (row = 0; row <= n_rows; row++) - { - /* Pass NULL as the child object, i.e. 4th argument */ - g_signal_emit_by_name (accessible, "children-changed::add", - (row * n_cols) + id, NULL, NULL); - } -} - -void -_gtk_tree_view_accessible_add_column (GtkTreeView *treeview, - GtkTreeViewColumn *column, - guint id) -{ - AtkObject *obj; - - if (!gtk_tree_view_column_get_visible (column)) - return; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (treeview)); - if (obj == NULL) - return; - - gtk_tree_view_accessible_do_add_column (GTK_TREE_VIEW_ACCESSIBLE (obj), - treeview, - column, - to_visible_column_id (treeview, id)); -} - -static void -gtk_tree_view_accessible_do_remove_column (GtkTreeViewAccessible *self, - GtkTreeView *treeview, - GtkTreeViewColumn *column, - guint id) -{ - GtkTreeViewAccessiblePrivate *priv = gtk_tree_view_accessible_get_instance_private (self); - GtkTreeViewAccessibleCellInfo *cell_info; - GHashTableIter iter; - gpointer value; - guint row, n_rows, n_cols; - - /* Clean column from cache */ - g_hash_table_iter_init (&iter, priv->cell_infos); - while (g_hash_table_iter_next (&iter, NULL, &value)) - { - cell_info = value; - if (cell_info->cell_col_ref == column) - g_hash_table_iter_remove (&iter); - } - - /* Generate column-deleted signal */ - g_signal_emit_by_name (self, "column-deleted", id, 1); - - n_rows = get_n_rows (treeview); - n_cols = get_n_columns (treeview); - - /* Generate children-changed signals */ - for (row = 0; row <= n_rows; row++) - { - /* Pass NULL as the child object, 4th argument */ - g_signal_emit_by_name (self, "children-changed::remove", - (row * n_cols) + id, NULL, NULL); - } -} - -void -_gtk_tree_view_accessible_remove_column (GtkTreeView *treeview, - GtkTreeViewColumn *column, - guint id) -{ - AtkObject *obj; - - if (!gtk_tree_view_column_get_visible (column)) - return; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (treeview)); - if (obj == NULL) - return; - - gtk_tree_view_accessible_do_remove_column (GTK_TREE_VIEW_ACCESSIBLE (obj), - treeview, - column, - to_visible_column_id (treeview, id)); -} - -void -_gtk_tree_view_accessible_reorder_column (GtkTreeView *treeview, - GtkTreeViewColumn *column) -{ - AtkObject *obj; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (treeview)); - if (obj == NULL) - return; - - g_signal_emit_by_name (obj, "column-reordered"); -} - -void -_gtk_tree_view_accessible_toggle_visibility (GtkTreeView *treeview, - GtkTreeViewColumn *column) -{ - AtkObject *obj; - guint i, id; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (treeview)); - if (obj == NULL) - return; - - if (gtk_tree_view_column_get_visible (column)) - { - id = get_column_number (treeview, column); - - gtk_tree_view_accessible_do_add_column (GTK_TREE_VIEW_ACCESSIBLE (obj), - treeview, - column, - id); - } - else - { - id = 0; - - for (i = 0; i < gtk_tree_view_get_n_columns (treeview); i++) - { - GtkTreeViewColumn *cur = gtk_tree_view_get_column (treeview, i); - - if (gtk_tree_view_column_get_visible (cur)) - id++; - - if (cur == column) - break; - } - - gtk_tree_view_accessible_do_remove_column (GTK_TREE_VIEW_ACCESSIBLE (obj), - treeview, - column, - id); - } -} - -static GtkTreeViewColumn * -get_effective_focus_column (GtkTreeView *treeview, - GtkTreeViewColumn *column) -{ - if (column == NULL && get_n_columns (treeview) > 0) - column = get_visible_column (treeview, 0); - - return column; -} - -void -_gtk_tree_view_accessible_update_focus_column (GtkTreeView *treeview, - GtkTreeViewColumn *old_focus, - GtkTreeViewColumn *new_focus) -{ - GtkTreeViewAccessible *accessible; - AtkObject *obj; - GtkTreeRBTree *cursor_tree; - GtkTreeRBNode *cursor_node; - GtkCellAccessible *cell; - - old_focus = get_effective_focus_column (treeview, old_focus); - new_focus = get_effective_focus_column (treeview, new_focus); - if (old_focus == new_focus) - return; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (treeview)); - if (obj == NULL) - return; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (obj); - - if (!_gtk_tree_view_get_cursor_node (treeview, &cursor_tree, &cursor_node)) - return; - - if (old_focus) - { - cell = peek_cell (accessible, cursor_tree, cursor_node, old_focus); - if (cell != NULL) - _gtk_cell_accessible_state_changed (cell, GTK_CELL_RENDERER_FOCUSED, 0); - } - - if (new_focus) - { - cell = peek_cell (accessible, cursor_tree, cursor_node, new_focus); - if (cell != NULL) - _gtk_cell_accessible_state_changed (cell, 0, GTK_CELL_RENDERER_FOCUSED); - else - cell = create_cell (treeview, accessible, cursor_tree, cursor_node, new_focus); - - g_signal_emit_by_name (accessible, "active-descendant-changed", cell); - } -} - -void -_gtk_tree_view_accessible_add_state (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node, - GtkCellRendererState state) -{ - GtkTreeViewAccessible *accessible; - GtkTreeViewColumn *single_column; - AtkObject *obj; - guint i; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (treeview)); - if (obj == NULL) - return; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (obj); - - if (state == GTK_CELL_RENDERER_FOCUSED) - { - single_column = get_effective_focus_column (treeview, _gtk_tree_view_get_focus_column (treeview)); - } - else if (state == GTK_CELL_RENDERER_EXPANDED || - state == GTK_CELL_RENDERER_EXPANDABLE) - { - single_column = gtk_tree_view_get_expander_column (treeview); - } - else - single_column = NULL; - - if (single_column) - { - GtkCellAccessible *cell = peek_cell (accessible, - tree, node, - single_column); - - if (cell != NULL) - _gtk_cell_accessible_state_changed (cell, state, 0); - - if (state == GTK_CELL_RENDERER_FOCUSED) - { - if (cell == NULL) - cell = create_cell (treeview, accessible, tree, node, single_column); - - g_signal_emit_by_name (accessible, "active-descendant-changed", cell); - } - } - else - { - for (i = 0; i < gtk_tree_view_get_n_columns (treeview); i++) - { - GtkCellAccessible *cell = peek_cell (accessible, - tree, node, - gtk_tree_view_get_column (treeview, i)); - - if (cell == NULL) - continue; - - _gtk_cell_accessible_state_changed (cell, state, 0); - } - } - - if (state == GTK_CELL_RENDERER_SELECTED) - g_signal_emit_by_name (accessible, "selection-changed"); -} - -void -_gtk_tree_view_accessible_remove_state (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node, - GtkCellRendererState state) -{ - GtkTreeViewAccessible *accessible; - GtkTreeViewColumn *single_column; - AtkObject *obj; - guint i; - - obj = _gtk_widget_peek_accessible (GTK_WIDGET (treeview)); - if (obj == NULL) - return; - - accessible = GTK_TREE_VIEW_ACCESSIBLE (obj); - - if (state == GTK_CELL_RENDERER_FOCUSED) - { - single_column = get_effective_focus_column (treeview, _gtk_tree_view_get_focus_column (treeview)); - } - else if (state == GTK_CELL_RENDERER_EXPANDED || - state == GTK_CELL_RENDERER_EXPANDABLE) - { - single_column = gtk_tree_view_get_expander_column (treeview); - } - else - single_column = NULL; - - if (single_column) - { - GtkCellAccessible *cell = peek_cell (accessible, - tree, node, - single_column); - - if (cell != NULL) - _gtk_cell_accessible_state_changed (cell, 0, state); - } - else - { - for (i = 0; i < gtk_tree_view_get_n_columns (treeview); i++) - { - GtkCellAccessible *cell = peek_cell (accessible, - tree, node, - gtk_tree_view_get_column (treeview, i)); - - if (cell == NULL) - continue; - - _gtk_cell_accessible_state_changed (cell, 0, state); - } - } - - if (state == GTK_CELL_RENDERER_SELECTED) - g_signal_emit_by_name (accessible, "selection-changed"); -} diff --git a/gtk/a11y/gtktreeviewaccessible.h b/gtk/a11y/gtktreeviewaccessible.h deleted file mode 100644 index 46b331592e..0000000000 --- a/gtk/a11y/gtktreeviewaccessible.h +++ /dev/null @@ -1,54 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_TREE_VIEW_ACCESSIBLE_H__ -#define __GTK_TREE_VIEW_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_TREE_VIEW_ACCESSIBLE (gtk_tree_view_accessible_get_type ()) -#define GTK_TREE_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_VIEW_ACCESSIBLE, GtkTreeViewAccessible)) -#define GTK_TREE_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TREE_VIEW_ACCESSIBLE, GtkTreeViewAccessibleClass)) -#define GTK_IS_TREE_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_VIEW_ACCESSIBLE)) -#define GTK_IS_TREE_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_VIEW_ACCESSIBLE)) -#define GTK_TREE_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_VIEW_ACCESSIBLE, GtkTreeViewAccessibleClass)) - -typedef struct _GtkTreeViewAccessible GtkTreeViewAccessible; -typedef struct _GtkTreeViewAccessibleClass GtkTreeViewAccessibleClass; - -struct _GtkTreeViewAccessible -{ - GtkWidgetAccessible parent; -}; - -struct _GtkTreeViewAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_tree_view_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_TREE_VIEW_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtktreeviewaccessibleprivate.h b/gtk/a11y/gtktreeviewaccessibleprivate.h deleted file mode 100644 index 2b132d9dc8..0000000000 --- a/gtk/a11y/gtktreeviewaccessibleprivate.h +++ /dev/null @@ -1,68 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_TREE_VIEW_ACCESSIBLE_PRIVATE_H__ -#define __GTK_TREE_VIEW_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtktreeviewaccessible.h> - -G_BEGIN_DECLS - -/* called by treeview code */ -void _gtk_tree_view_accessible_reorder (GtkTreeView *treeview); -void _gtk_tree_view_accessible_add (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node); -void _gtk_tree_view_accessible_remove (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node); -void _gtk_tree_view_accessible_changed (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node); - -void _gtk_tree_view_accessible_add_column (GtkTreeView *treeview, - GtkTreeViewColumn *column, - guint id); -void _gtk_tree_view_accessible_remove_column (GtkTreeView *treeview, - GtkTreeViewColumn *column, - guint id); -void _gtk_tree_view_accessible_reorder_column - (GtkTreeView *treeview, - GtkTreeViewColumn *column); -void _gtk_tree_view_accessible_toggle_visibility - (GtkTreeView *treeview, - GtkTreeViewColumn *column); -void _gtk_tree_view_accessible_update_focus_column - (GtkTreeView *treeview, - GtkTreeViewColumn *old_focus, - GtkTreeViewColumn *new_focus); - -void _gtk_tree_view_accessible_add_state (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node, - GtkCellRendererState state); -void _gtk_tree_view_accessible_remove_state (GtkTreeView *treeview, - GtkTreeRBTree *tree, - GtkTreeRBNode *node, - GtkCellRendererState state); - -void gtk_tree_view_accessible_update_model (GtkTreeViewAccessible *self, - GtkTreeModel *model); - -G_END_DECLS - -#endif /* __GTK_TREE_VIEW_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c deleted file mode 100644 index 1941952e79..0000000000 --- a/gtk/a11y/gtkwidgetaccessible.c +++ /dev/null @@ -1,789 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkwidgetaccessibleprivate.h" - -#include "gtkaccellabel.h" -#include "gtkadjustment.h" -#include "gtkbox.h" -#include "gtkbutton.h" -#include "gtkcombobox.h" -#include "gtkdragicon.h" -#include "gtkdrawingarea.h" -#include "gtkglarea.h" -#include "gtkimage.h" -#include "gtklevelbar.h" -#include "gtkmediacontrols.h" -#include "gtknotebookpageaccessible.h" -#include "gtknotebook.h" -#include "gtkorientable.h" -#include "gtkpicture.h" -#include "gtkprogressbar.h" -#include "gtkscrollable.h" -#include "gtkscrollbar.h" -#include "gtkseparator.h" -#include "gtkshortcutlabel.h" -#include "gtkshortcutsshortcut.h" -#include "gtkspinner.h" -#include "gtkstacksidebar.h" -#include "gtkstatusbar.h" -#include "gtkvideo.h" -#include "gtkviewport.h" -#include "gtkwidgetprivate.h" - -typedef struct -{ - AtkLayer layer; -} GtkWidgetAccessiblePrivate; - -extern GtkWidget *_focus_widget; - -static gboolean gtk_widget_accessible_on_screen (GtkWidget *widget); -static gboolean gtk_widget_accessible_all_parents_visible (GtkWidget *widget); - -static void atk_component_interface_init (AtkComponentIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkWidgetAccessible, gtk_widget_accessible, GTK_TYPE_ACCESSIBLE, - G_ADD_PRIVATE (GtkWidgetAccessible) - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)) - -/*< private > - * gtk_widget_accessible_update_bounds: - * @self: a #GtkWidgetAccessible - * - * Updates the bounds of the widget's accessible implementation using - * the widget's allocation. - */ -void -gtk_widget_accessible_update_bounds (GtkWidgetAccessible *self) -{ - GtkAllocation alloc; - AtkRectangle rect; - - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); - gtk_widget_get_allocation (widget, &alloc); - - rect.x = alloc.x; - rect.y = alloc.y; - rect.width = alloc.width; - rect.height = alloc.height; - - g_signal_emit_by_name (self, "bounds-changed", &rect); -} - -/*< private > - * gtk_widget_accessible_notify_showing: - * @self: a #GtkWidgetAccessible - * - * Translates the #GtkWidget mapped state into the #AtkObject - * showing state. - */ -void -gtk_widget_accessible_notify_showing (GtkWidgetAccessible *self) -{ - g_return_if_fail (GTK_IS_WIDGET_ACCESSIBLE (self)); - - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); - - atk_object_notify_state_change (ATK_OBJECT (self), - ATK_STATE_SHOWING, - gtk_widget_get_mapped (widget)); -} - -void -gtk_widget_accessible_notify_tooltip (GtkWidgetAccessible *self) -{ - g_return_if_fail (GTK_IS_WIDGET_ACCESSIBLE (self)); - - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); - - atk_object_notify_state_change (ATK_OBJECT (self), - ATK_STATE_HAS_TOOLTIP, - gtk_widget_get_has_tooltip (widget)); -} - -void -gtk_widget_accessible_notify_visible (GtkWidgetAccessible *self) -{ - g_return_if_fail (GTK_IS_WIDGET_ACCESSIBLE (self)); - - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); - - atk_object_notify_state_change (ATK_OBJECT (self), - ATK_STATE_VISIBLE, - gtk_widget_get_visible (widget)); -} - -void -gtk_widget_accessible_notify_sensitive (GtkWidgetAccessible *self) -{ - g_return_if_fail (GTK_IS_WIDGET_ACCESSIBLE (self)); - - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); - gboolean is_sensitive = gtk_widget_get_sensitive (widget); - - atk_object_notify_state_change (ATK_OBJECT (self), - ATK_STATE_SENSITIVE, - is_sensitive); - atk_object_notify_state_change (ATK_OBJECT (self), - ATK_STATE_ENABLED, - is_sensitive); -} - -void -gtk_widget_accessible_notify_focus (GtkWidgetAccessible *self) -{ - g_return_if_fail (GTK_IS_WIDGET_ACCESSIBLE (self)); - - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); - - atk_object_notify_state_change (ATK_OBJECT (self), - ATK_STATE_FOCUSED, - gtk_widget_has_focus (widget)); -} - -void -gtk_widget_accessible_notify_orientation (GtkWidgetAccessible *self) -{ - g_return_if_fail (GTK_IS_WIDGET_ACCESSIBLE (self)); - - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); - - if (GTK_IS_ORIENTABLE (widget)) - { - GtkOrientable *orientable = GTK_ORIENTABLE (widget); - GtkOrientation orientation = gtk_orientable_get_orientation (orientable); - - atk_object_notify_state_change (ATK_OBJECT (self), - ATK_STATE_HORIZONTAL, - orientation == GTK_ORIENTATION_HORIZONTAL); - atk_object_notify_state_change (ATK_OBJECT (self), - ATK_STATE_VERTICAL, - orientation == GTK_ORIENTATION_VERTICAL); - } -} - -static void -gtk_widget_accessible_initialize (AtkObject *object, - gpointer data) -{ - GtkWidgetAccessible *self = GTK_WIDGET_ACCESSIBLE (object); - GtkWidgetAccessiblePrivate *priv = gtk_widget_accessible_get_instance_private (self); - - priv->layer = ATK_LAYER_WIDGET; - - atk_object_set_role (object, ATK_ROLE_UNKNOWN); -} - -static const char * -gtk_widget_accessible_get_description (AtkObject *accessible) -{ - GtkWidget *widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - if (accessible->description != NULL) - return accessible->description; - - return gtk_widget_get_tooltip_text (widget); -} - -static AtkObject * -gtk_widget_accessible_get_parent (AtkObject *accessible) -{ - AtkObject *parent; - GtkWidget *widget, *parent_widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - parent = accessible->accessible_parent; - if (parent != NULL) - return parent; - - parent_widget = gtk_widget_get_parent (widget); - if (parent_widget == NULL) - return NULL; - - /* For a widget whose parent is a GtkNoteBook, we return the - * accessible object corresponding the GtkNotebookPage containing - * the widget as the accessible parent. - */ - if (GTK_IS_NOTEBOOK (parent_widget)) - { - int page_num; - GtkWidget *child; - GtkNotebook *notebook; - - page_num = 0; - notebook = GTK_NOTEBOOK (parent_widget); - while (TRUE) - { - child = gtk_notebook_get_nth_page (notebook, page_num); - if (!child) - break; - if (child == widget) - { - parent = gtk_widget_get_accessible (parent_widget); - parent = atk_object_ref_accessible_child (parent, page_num); - g_object_unref (parent); - return parent; - } - page_num++; - } - } - parent = gtk_widget_get_accessible (parent_widget); - return parent; -} - -static GtkWidget * -find_label (GtkWidget *widget) -{ - GList *labels; - GtkWidget *label; - GtkWidget *temp_widget; - GList *ptr; - - labels = gtk_widget_list_mnemonic_labels (widget); - label = NULL; - ptr = labels; - while (ptr) - { - if (ptr->data) - { - label = ptr->data; - break; - } - ptr = ptr->next; - } - g_list_free (labels); - - /* Ignore a label within a button; bug #136602 */ - if (label && GTK_IS_BUTTON (widget)) - { - temp_widget = label; - while (temp_widget) - { - if (temp_widget == widget) - { - label = NULL; - break; - } - temp_widget = gtk_widget_get_parent (temp_widget); - } - } - return label; -} - -static AtkRelationSet * -gtk_widget_accessible_ref_relation_set (AtkObject *obj) -{ - GtkWidget *widget; - AtkRelationSet *relation_set; - GtkWidget *label; - AtkObject *array[1]; - AtkRelation* relation; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - relation_set = ATK_OBJECT_CLASS (gtk_widget_accessible_parent_class)->ref_relation_set (obj); - - if (GTK_IS_BOX (widget)) - return relation_set; - - if (!atk_relation_set_contains (relation_set, ATK_RELATION_LABELLED_BY)) - { - label = find_label (widget); - if (label == NULL) - { - if (GTK_IS_BUTTON (widget) && gtk_widget_get_mapped (widget)) - /* - * Handle the case where GnomeIconEntry is the mnemonic widget. - * The GtkButton which is a grandchild of the GnomeIconEntry - * should really be the mnemonic widget. See bug #133967. - */ - { - GtkWidget *temp_widget; - - temp_widget = gtk_widget_get_parent (widget); - if (GTK_IS_BOX (temp_widget)) - { - label = find_label (temp_widget); - if (!label) - label = find_label (gtk_widget_get_parent (temp_widget)); - } - } - else if (GTK_IS_COMBO_BOX (widget)) - /* - * Handle the case when GtkFileChooserButton is the mnemonic - * widget. The GtkComboBox which is a child of the - * GtkFileChooserButton should be the mnemonic widget. - * See bug #359843. - */ - { - GtkWidget *temp_widget; - - temp_widget = gtk_widget_get_parent (widget); - if (GTK_IS_BOX (temp_widget)) - { - label = find_label (temp_widget); - } - } - } - - if (label) - { - array[0] = gtk_widget_get_accessible (label); - - relation = atk_relation_new (array, 1, ATK_RELATION_LABELLED_BY); - atk_relation_set_add (relation_set, relation); - g_object_unref (relation); - } - } - - return relation_set; -} - -static gboolean -takes_focus (GtkWidget *widget) -{ - if (GTK_IS_NOTEBOOK (widget) || - GTK_IS_BUTTON (widget)) - return TRUE; - - if (GTK_IS_ACCEL_LABEL (widget) || - GTK_IS_DRAG_ICON (widget) || - GTK_IS_DRAWING_AREA (widget) || - GTK_IS_GL_AREA (widget) || - GTK_IS_IMAGE (widget) || - GTK_IS_LEVEL_BAR (widget) || - GTK_IS_MEDIA_CONTROLS (widget) || - GTK_IS_PICTURE (widget) || - GTK_IS_PROGRESS_BAR (widget) || - GTK_IS_SCROLLBAR (widget) || - GTK_IS_SEPARATOR (widget) || - GTK_IS_SHORTCUT_LABEL (widget) || - GTK_IS_SHORTCUTS_SHORTCUT (widget) || - GTK_IS_SPINNER (widget) || - GTK_IS_STACK_SIDEBAR (widget) || - GTK_IS_STATUSBAR (widget) || - GTK_IS_VIDEO (widget)) - return FALSE; - - return gtk_widget_get_can_focus (widget); -} - -static AtkStateSet * -gtk_widget_accessible_ref_state_set (AtkObject *accessible) -{ - GtkWidget *widget; - AtkStateSet *state_set; - - state_set = ATK_OBJECT_CLASS (gtk_widget_accessible_parent_class)->ref_state_set (accessible); - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT); - else - { - if (gtk_widget_is_sensitive (widget)) - { - atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE); - atk_state_set_add_state (state_set, ATK_STATE_ENABLED); - } - - if (takes_focus (widget)) - { - atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); - } - /* - * We do not currently generate notifications when an ATK object - * corresponding to a GtkWidget changes visibility by being scrolled - * on or off the screen. The testcase for this is the main window - * of the testgtk application in which a set of buttons in a GtkVBox - * is in a scrolled window with a viewport. - * - * To generate the notifications we would need to do the following: - * 1) Find the GtkViewport among the ancestors of the objects - * 2) Create an accessible for the viewport - * 3) Connect to the value-changed signal on the viewport - * 4) When the signal is received we need to traverse the children - * of the viewport and check whether the children are visible or not - * visible; we may want to restrict this to the widgets for which - * accessible objects have been created. - * 5) We probably need to store a variable on_screen in the - * GtkWidgetAccessible data structure so we can determine whether - * the value has changed. - */ - if (gtk_widget_get_visible (widget)) - { - atk_state_set_add_state (state_set, ATK_STATE_VISIBLE); - if (gtk_widget_accessible_on_screen (widget) && - gtk_widget_get_mapped (widget) && - gtk_widget_accessible_all_parents_visible (widget)) - atk_state_set_add_state (state_set, ATK_STATE_SHOWING); - } - - if (gtk_widget_has_focus (widget)) - atk_state_set_add_state (state_set, ATK_STATE_FOCUSED); - - if (gtk_widget_has_default (widget)) - atk_state_set_add_state (state_set, ATK_STATE_DEFAULT); - - if (GTK_IS_ORIENTABLE (widget)) - { - if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL) - atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL); - else - atk_state_set_add_state (state_set, ATK_STATE_VERTICAL); - } - - if (gtk_widget_get_has_tooltip (widget)) - atk_state_set_add_state (state_set, ATK_STATE_HAS_TOOLTIP); - } - return state_set; -} - -static int -gtk_widget_accessible_get_index_in_parent (AtkObject *accessible) -{ - GtkWidget *widget; - GtkWidget *parent_widget; - int index; - GtkWidget *ch; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - - if (widget == NULL) - return -1; - - if (accessible->accessible_parent) - { - AtkObject *parent; - - parent = accessible->accessible_parent; - - if (GTK_IS_NOTEBOOK_PAGE_ACCESSIBLE (parent)) - return 0; - else - { - int n_children, i; - gboolean found = FALSE; - - n_children = atk_object_get_n_accessible_children (parent); - for (i = 0; i < n_children; i++) - { - AtkObject *child; - - child = atk_object_ref_accessible_child (parent, i); - if (child == accessible) - found = TRUE; - - g_object_unref (child); - if (found) - return i; - } - } - } - - parent_widget = gtk_widget_get_parent (widget); - for (ch = gtk_widget_get_first_child (parent_widget), index = 0; - ch != NULL; - ch = gtk_widget_get_next_sibling (ch), index++) - { - if (ch == widget) - break; - } - - return index; -} - -static AtkAttributeSet * -gtk_widget_accessible_get_attributes (AtkObject *obj) -{ - AtkAttributeSet *attributes; - AtkAttribute *toolkit; - - toolkit = g_new (AtkAttribute, 1); - toolkit->name = g_strdup ("toolkit"); - toolkit->value = g_strdup ("gtk"); - - attributes = g_slist_append (NULL, toolkit); - - return attributes; -} - -static int -gtk_widget_accessible_get_n_children (AtkObject *object) -{ - GtkWidget *window; - GtkWidget *child; - int count = 0; - - window = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); - for (child = gtk_widget_get_first_child (GTK_WIDGET (window)); - child != NULL; - child = gtk_widget_get_next_sibling (child)) - count++; - - return count; -} - -static AtkObject * -gtk_widget_accessible_ref_child (AtkObject *object, - int i) -{ - GtkWidget *window, *child; - int pos; - - window = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); - for (child = gtk_widget_get_first_child (GTK_WIDGET (window)), pos = 0; - child != NULL; - child = gtk_widget_get_next_sibling (child), pos++) - { - if (pos == i) - return g_object_ref (gtk_widget_get_accessible (child)); - } - - return NULL; -} - -static void -gtk_widget_accessible_class_init (GtkWidgetAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->get_description = gtk_widget_accessible_get_description; - class->get_parent = gtk_widget_accessible_get_parent; - class->ref_relation_set = gtk_widget_accessible_ref_relation_set; - class->ref_state_set = gtk_widget_accessible_ref_state_set; - class->get_index_in_parent = gtk_widget_accessible_get_index_in_parent; - class->initialize = gtk_widget_accessible_initialize; - class->get_attributes = gtk_widget_accessible_get_attributes; - class->get_n_children = gtk_widget_accessible_get_n_children; - class->ref_child = gtk_widget_accessible_ref_child; -} - -static void -gtk_widget_accessible_init (GtkWidgetAccessible *accessible) -{ -} - -static void -gtk_widget_accessible_get_extents (AtkComponent *component, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkWidget *widget; - GtkAllocation allocation; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (widget == NULL) - return; - - gtk_widget_get_allocation (widget, &allocation); - *width = allocation.width; - *height = allocation.height; - if (!gtk_widget_accessible_on_screen (widget) || (!gtk_widget_is_drawable (widget))) - { - *x = G_MININT; - *y = G_MININT; - return; - } - - if (gtk_widget_get_parent (widget)) - { - *x = allocation.x; - *y = allocation.y; - } - else - { - *x = 0; - *y = 0; - } -} - -static AtkLayer -gtk_widget_accessible_get_layer (AtkComponent *component) -{ - GtkWidgetAccessible *self = GTK_WIDGET_ACCESSIBLE (component); - GtkWidgetAccessiblePrivate *priv = gtk_widget_accessible_get_instance_private (self); - - return priv->layer; -} - -static gboolean -gtk_widget_accessible_grab_focus (AtkComponent *component) -{ - GtkWidget *widget; - GtkWidget *toplevel; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (!widget) - return FALSE; - - if (!gtk_widget_get_can_focus (widget)) - return FALSE; - - gtk_widget_grab_focus (widget); - toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); - if (GTK_IS_WINDOW (toplevel)) - { - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_window_present (GTK_WINDOW (toplevel)); - G_GNUC_END_IGNORE_DEPRECATIONS - } - - return TRUE; -} - -static gboolean -gtk_widget_accessible_set_extents (AtkComponent *component, - int x, - int y, - int width, - int height, - AtkCoordType coord_type) -{ - return FALSE; -} - -static gboolean -gtk_widget_accessible_set_position (AtkComponent *component, - int x, - int y, - AtkCoordType coord_type) -{ - return FALSE; -} - -static gboolean -gtk_widget_accessible_set_size (AtkComponent *component, - int width, - int height) -{ - return FALSE; -} - -static void -atk_component_interface_init (AtkComponentIface *iface) -{ - iface->get_extents = gtk_widget_accessible_get_extents; - iface->get_layer = gtk_widget_accessible_get_layer; - iface->grab_focus = gtk_widget_accessible_grab_focus; - iface->set_extents = gtk_widget_accessible_set_extents; - iface->set_position = gtk_widget_accessible_set_position; - iface->set_size = gtk_widget_accessible_set_size; -} - -/* This function checks whether the widget has an ancestor which is - * a GtkViewport and, if so, whether any part of the widget intersects - * the visible rectangle of the GtkViewport. - */ -static gboolean -gtk_widget_accessible_on_screen (GtkWidget *widget) -{ - GtkAllocation allocation; - GtkWidget *viewport; - gboolean return_value; - - gtk_widget_get_allocation (widget, &allocation); - - if (!gtk_widget_get_mapped (widget)) - return FALSE; - - viewport = gtk_widget_get_ancestor (widget, GTK_TYPE_VIEWPORT); - if (viewport) - { - GtkAllocation viewport_allocation; - GtkAdjustment *adjustment; - GdkRectangle visible_rect; - - gtk_widget_get_allocation (viewport, &viewport_allocation); - - adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (viewport)); - visible_rect.y = gtk_adjustment_get_value (adjustment); - adjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (viewport)); - visible_rect.x = gtk_adjustment_get_value (adjustment); - visible_rect.width = viewport_allocation.width; - visible_rect.height = viewport_allocation.height; - - if (((allocation.x + allocation.width) < visible_rect.x) || - ((allocation.y + allocation.height) < visible_rect.y) || - (allocation.x > (visible_rect.x + visible_rect.width)) || - (allocation.y > (visible_rect.y + visible_rect.height))) - return_value = FALSE; - else - return_value = TRUE; - } - else - { - /* Check whether the widget has been placed of the screen. - * The widget may be MAPPED as when toolbar items do not - * fit on the toolbar. - */ - if (allocation.x + allocation.width <= 0 && - allocation.y + allocation.height <= 0) - return_value = FALSE; - else - return_value = TRUE; - } - - return return_value; -} - -/* Checks if all the predecessors (the parent widget, his parent, etc) - * are visible Used to check properly the SHOWING state. - */ -static gboolean -gtk_widget_accessible_all_parents_visible (GtkWidget *widget) -{ - GtkWidget *iter_parent = NULL; - gboolean result = TRUE; - - for (iter_parent = _gtk_widget_get_parent (widget); - iter_parent != NULL; - iter_parent = _gtk_widget_get_parent (iter_parent)) - { - if (!_gtk_widget_get_visible (iter_parent)) - { - result = FALSE; - break; - } - } - - return result; -} - -void -_gtk_widget_accessible_set_layer (GtkWidgetAccessible *self, - AtkLayer layer) -{ - GtkWidgetAccessiblePrivate *priv = gtk_widget_accessible_get_instance_private (self); - - priv->layer = layer; -} diff --git a/gtk/a11y/gtkwidgetaccessible.h b/gtk/a11y/gtkwidgetaccessible.h deleted file mode 100644 index fd4e02654e..0000000000 --- a/gtk/a11y/gtkwidgetaccessible.h +++ /dev/null @@ -1,41 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_WIDGET_ACCESSIBLE_H__ -#define __GTK_WIDGET_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/gtkaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_WIDGET_ACCESSIBLE (gtk_widget_accessible_get_type()) - -GDK_AVAILABLE_IN_ALL -G_DECLARE_DERIVABLE_TYPE (GtkWidgetAccessible, gtk_widget_accessible, GTK, WIDGET_ACCESSIBLE, GtkAccessible) - -struct _GtkWidgetAccessibleClass -{ - GtkAccessibleClass parent_class; -}; - -G_END_DECLS - -#endif /* __GTK_WIDGET_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkwidgetaccessibleprivate.h b/gtk/a11y/gtkwidgetaccessibleprivate.h deleted file mode 100644 index e60abcb337..0000000000 --- a/gtk/a11y/gtkwidgetaccessibleprivate.h +++ /dev/null @@ -1,44 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_WIDGET_ACCESSIBLE_PRIVATE_H__ -#define __GTK_WIDGET_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -void _gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible, - AtkLayer layer); - -void gtk_widget_accessible_update_bounds (GtkWidgetAccessible *self); - -void gtk_widget_accessible_notify_showing (GtkWidgetAccessible *self); - -void gtk_widget_accessible_notify_tooltip (GtkWidgetAccessible *self); - -void gtk_widget_accessible_notify_visible (GtkWidgetAccessible *self); - -void gtk_widget_accessible_notify_sensitive (GtkWidgetAccessible *self); - -void gtk_widget_accessible_notify_focus (GtkWidgetAccessible *self); - -void gtk_widget_accessible_notify_orientation (GtkWidgetAccessible *self); - -G_END_DECLS - -#endif /* __GTK_WIDGET_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/gtkwindowaccessible.c b/gtk/a11y/gtkwindowaccessible.c deleted file mode 100644 index 65f746e80d..0000000000 --- a/gtk/a11y/gtkwindowaccessible.c +++ /dev/null @@ -1,346 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2011, F123 Consulting & Mais Diferenças - * Copyright 2001, 2002, 2003 Sun Microsystems Inc. - * - * 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 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/>. - */ - -#include "config.h" - -#include "gtkwindowaccessibleprivate.h" - -#include "gtkaccessibility.h" -#include "gtktoplevelaccessible.h" -#include "gtkwidgetaccessibleprivate.h" - -#include "gtklabel.h" -#include "gtkwidgetprivate.h" -#include "gtkwindowprivate.h" -#include "gtknative.h" - -/* atkcomponent.h */ - -static void gtk_window_accessible_get_extents (AtkComponent *component, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type); -static void gtk_window_accessible_get_size (AtkComponent *component, - int *width, - int *height); - -static void atk_component_interface_init (AtkComponentIface *iface); -static void atk_window_interface_init (AtkWindowIface *iface); - -G_DEFINE_TYPE_WITH_CODE (GtkWindowAccessible, - gtk_window_accessible, - GTK_TYPE_WIDGET_ACCESSIBLE, - G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, - atk_component_interface_init) - G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW, - atk_window_interface_init)); - - -static void -gtk_window_accessible_focus_event (AtkObject *obj, - gboolean focus_in) -{ - atk_object_notify_state_change (obj, ATK_STATE_ACTIVE, focus_in); -} - -static void -on_title_changed (GObject *gobject, - GParamSpec *pspec, - GtkWindowAccessible *self) -{ - AtkObject *atk_obj = ATK_OBJECT (self); - - g_object_notify (G_OBJECT (atk_obj), "accessible-name"); - g_signal_emit_by_name (atk_obj, "visible-data-changed"); -} - -static const char * -gtk_window_accessible_get_name (AtkObject *accessible) -{ - const char * name; - GtkWidget* widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - name = ATK_OBJECT_CLASS (gtk_window_accessible_parent_class)->get_name (accessible); - if (name != NULL) - return name; - - if (GTK_IS_WINDOW (widget)) - { - GtkWindow *window = GTK_WINDOW (widget); - - name = gtk_window_get_title (window); - } - return name; -} - -static int -gtk_window_accessible_get_index_in_parent (AtkObject *accessible) -{ - GtkWidget* widget; - AtkObject* atk_obj; - int index = -1; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return -1; - - index = ATK_OBJECT_CLASS (gtk_window_accessible_parent_class)->get_index_in_parent (accessible); - if (index != -1) - return index; - - atk_obj = atk_get_root (); - - if (GTK_IS_WINDOW (widget)) - { - GtkWindow *window = GTK_WINDOW (widget); - if (GTK_IS_TOPLEVEL_ACCESSIBLE (atk_obj)) - { - GtkToplevelAccessible *toplevel = GTK_TOPLEVEL_ACCESSIBLE (atk_obj); - index = g_list_index (gtk_toplevel_accessible_get_children (toplevel), window); - } - else - { - int i, sibling_count; - - sibling_count = atk_object_get_n_accessible_children (atk_obj); - for (i = 0; i < sibling_count && index == -1; ++i) - { - AtkObject *child = atk_object_ref_accessible_child (atk_obj, i); - if (accessible == child) - index = i; - g_object_unref (G_OBJECT (child)); - } - } - } - return index; -} - -static AtkRelationSet * -gtk_window_accessible_ref_relation_set (AtkObject *obj) -{ - GtkWidget *widget; - AtkRelationSet *relation_set; - AtkObject *array[1]; - AtkRelation* relation; - GtkWidget *current_widget; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - if (widget == NULL) - return NULL; - - relation_set = ATK_OBJECT_CLASS (gtk_window_accessible_parent_class)->ref_relation_set (obj); - - if (atk_object_get_role (obj) == ATK_ROLE_TOOL_TIP) - { - relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_POPUP_FOR); - if (relation) - atk_relation_set_remove (relation_set, relation); - - if (0) /* FIXME need a way to go from tooltip window to widget */ - { - array[0] = gtk_widget_get_accessible (current_widget); - relation = atk_relation_new (array, 1, ATK_RELATION_POPUP_FOR); - atk_relation_set_add (relation_set, relation); - g_object_unref (relation); - } - } - return relation_set; -} - -static AtkStateSet * -gtk_window_accessible_ref_state_set (AtkObject *accessible) -{ - AtkStateSet *state_set; - GtkWidget *widget; - GtkWindow *window; - GdkSurface *gdk_surface; - GdkSurfaceState state; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - state_set = ATK_OBJECT_CLASS (gtk_window_accessible_parent_class)->ref_state_set (accessible); - - window = GTK_WINDOW (widget); - - if (gtk_window_is_active (window)) - atk_state_set_add_state (state_set, ATK_STATE_ACTIVE); - - gdk_surface = gtk_native_get_surface (GTK_NATIVE (window)); - if (GDK_IS_TOPLEVEL (gdk_surface)) - { - state = gdk_toplevel_get_state (GDK_TOPLEVEL (gdk_surface)); - if (state & GDK_SURFACE_STATE_MINIMIZED) - atk_state_set_add_state (state_set, ATK_STATE_ICONIFIED); - } - if (gtk_window_get_modal (window)) - atk_state_set_add_state (state_set, ATK_STATE_MODAL); - - if (gtk_window_get_resizable (window)) - atk_state_set_add_state (state_set, ATK_STATE_RESIZABLE); - - return state_set; -} - -static int -gtk_window_accessible_get_n_children (AtkObject *object) -{ - GtkWidget *window; - GtkWidget *child; - int count = 0; - - window = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); - for (child = gtk_widget_get_first_child (GTK_WIDGET (window)); - child != NULL; - child = gtk_widget_get_next_sibling (child)) - count++; - - return count; -} - -static AtkObject * -gtk_window_accessible_ref_child (AtkObject *object, - int i) -{ - GtkWidget *window, *child; - int pos; - - window = gtk_accessible_get_widget (GTK_ACCESSIBLE (object)); - for (child = gtk_widget_get_first_child (GTK_WIDGET (window)), pos = 0; - child != NULL; - child = gtk_widget_get_next_sibling (child), pos++) - { - if (pos == i) - return g_object_ref (gtk_widget_get_accessible (child)); - } - - return NULL; -} - -static void -gtk_window_accessible_initialize (AtkObject *object, - gpointer data) -{ - GtkWidget *window = data; - - g_signal_connect (window, "notify::title", G_CALLBACK (on_title_changed), object); -} - -static void -gtk_window_accessible_class_init (GtkWindowAccessibleClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - class->initialize = gtk_window_accessible_initialize; - class->get_name = gtk_window_accessible_get_name; - class->get_index_in_parent = gtk_window_accessible_get_index_in_parent; - class->ref_relation_set = gtk_window_accessible_ref_relation_set; - class->ref_state_set = gtk_window_accessible_ref_state_set; - class->focus_event = gtk_window_accessible_focus_event; - class->get_n_children = gtk_window_accessible_get_n_children; - class->ref_child = gtk_window_accessible_ref_child; -} - -static void -gtk_window_accessible_init (GtkWindowAccessible *accessible) -{ -} - -static void -gtk_window_accessible_get_extents (AtkComponent *component, - int *x, - int *y, - int *width, - int *height, - AtkCoordType coord_type) -{ - GtkWidget *widget; - GdkSurface *surface; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (widget == NULL) - return; - - surface = gtk_native_get_surface (GTK_NATIVE (widget)); - if (surface == NULL) - return; - - *x = 0; - *y = 0; - *width = gdk_surface_get_width (surface); - *height = gdk_surface_get_height (surface); - if (!gtk_widget_is_drawable (widget)) - { - *x = G_MININT; - *y = G_MININT; - return; - } -} - -static void -gtk_window_accessible_get_size (AtkComponent *component, - int *width, - int *height) -{ - GtkWidget *widget; - GdkSurface *surface; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (component)); - if (widget == NULL) - return; - - surface = gtk_native_get_surface (GTK_NATIVE (widget)); - if (surface == NULL) - return; - - *width = gdk_surface_get_width (surface); - *height = gdk_surface_get_height (surface); -} - -void -_gtk_window_accessible_set_is_active (GtkWindow *window, - gboolean is_active) -{ - AtkObject *accessible = _gtk_widget_peek_accessible (GTK_WIDGET (window)); - - if (accessible == NULL) - return; - - g_signal_emit_by_name (accessible, is_active ? "activate" : "deactivate"); -} - - -static void -atk_component_interface_init (AtkComponentIface *iface) -{ - iface->get_extents = gtk_window_accessible_get_extents; - iface->get_size = gtk_window_accessible_get_size; -} - -static void -atk_window_interface_init (AtkWindowIface *iface) -{ - /* At this moment AtkWindow is just about signals */ -} diff --git a/gtk/a11y/gtkwindowaccessible.h b/gtk/a11y/gtkwindowaccessible.h deleted file mode 100644 index 39250190cb..0000000000 --- a/gtk/a11y/gtkwindowaccessible.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright 2001 Sun Microsystems Inc. - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_WINDOW_ACCESSIBLE_H__ -#define __GTK_WINDOW_ACCESSIBLE_H__ - -#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk-a11y.h> can be included directly." -#endif - -#include <gtk/a11y/gtkwidgetaccessible.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_WINDOW_ACCESSIBLE (gtk_window_accessible_get_type ()) -#define GTK_WINDOW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WINDOW_ACCESSIBLE, GtkWindowAccessible)) -#define GTK_WINDOW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WINDOW_ACCESSIBLE, GtkWindowAccessibleClass)) -#define GTK_IS_WINDOW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WINDOW_ACCESSIBLE)) -#define GTK_IS_WINDOW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WINDOW_ACCESSIBLE)) -#define GTK_WINDOW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW_ACCESSIBLE, GtkWindowAccessibleClass)) - -typedef struct _GtkWindowAccessible GtkWindowAccessible; -typedef struct _GtkWindowAccessibleClass GtkWindowAccessibleClass; -typedef struct _GtkWindowAccessiblePrivate GtkWindowAccessiblePrivate; - -struct _GtkWindowAccessible -{ - GtkWidgetAccessible parent; - - GtkWindowAccessiblePrivate *priv; -}; - -struct _GtkWindowAccessibleClass -{ - GtkWidgetAccessibleClass parent_class; -}; - -GDK_AVAILABLE_IN_ALL -GType gtk_window_accessible_get_type (void); - -G_END_DECLS - -#endif /* __GTK_WINDOW_ACCESSIBLE_H__ */ diff --git a/gtk/a11y/gtkwindowaccessibleprivate.h b/gtk/a11y/gtkwindowaccessibleprivate.h deleted file mode 100644 index ba2fbfb9e8..0000000000 --- a/gtk/a11y/gtkwindowaccessibleprivate.h +++ /dev/null @@ -1,30 +0,0 @@ -/* GTK+ - accessibility implementations - * Copyright (C) 2018 Benjamin Otte <otte@gnome.org> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_WINDOW_ACCESSIBLE_PRIVATE_H__ -#define __GTK_WINDOW_ACCESSIBLE_PRIVATE_H__ - -#include <gtk/a11y/gtkwindowaccessible.h> - -G_BEGIN_DECLS - -void _gtk_window_accessible_set_is_active (GtkWindow *window, - gboolean is_active); - -G_END_DECLS - -#endif /* __GTK_WINDOW_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/a11y/meson.build b/gtk/a11y/meson.build deleted file mode 100644 index 10d74907f9..0000000000 --- a/gtk/a11y/meson.build +++ /dev/null @@ -1,109 +0,0 @@ -a11y_sources = files([ - 'gtkaccessibility.c', - 'gtkaccessibilityutil.c', - 'gtkbooleancellaccessible.c', - 'gtkbuttonaccessible.c', - 'gtkcellaccessible.c', - 'gtkcellaccessibleparent.c', - 'gtkcolorswatchaccessible.c', - 'gtkcomboboxaccessible.c', - 'gtkcompositeaccessible.c', - 'gtkcontainercellaccessible.c', - 'gtkentryaccessible.c', - 'gtkexpanderaccessible.c', - 'gtkflowboxaccessible.c', - 'gtkflowboxchildaccessible.c', - 'gtkframeaccessible.c', - 'gtkiconviewaccessible.c', - 'gtkimageaccessible.c', - 'gtkimagecellaccessible.c', - 'gtklabelaccessible.c', - 'gtklevelbaraccessible.c', - 'gtklinkbuttonaccessible.c', - 'gtklistboxaccessible.c', - 'gtklistboxrowaccessible.c', - 'gtklockbuttonaccessible.c', - 'gtkmenubuttonaccessible.c', - 'gtknotebookaccessible.c', - 'gtknotebookpageaccessible.c', - 'gtkpanedaccessible.c', - 'gtkpasswordentryaccessible.c', - 'gtkpictureaccessible.c', - 'gtkpopoveraccessible.c', - 'gtkprogressbaraccessible.c', - 'gtkradiobuttonaccessible.c', - 'gtkrangeaccessible.c', - 'gtkrenderercellaccessible.c', - 'gtkscaleaccessible.c', - 'gtkscalebuttonaccessible.c', - 'gtkscrollbaraccessible.c', - 'gtkscrolledwindowaccessible.c', - 'gtksearchentryaccessible.c', - 'gtkspinbuttonaccessible.c', - 'gtkspinneraccessible.c', - 'gtkstackaccessible.c', - 'gtkstatusbaraccessible.c', - 'gtkswitchaccessible.c', - 'gtktextaccessible.c', - 'gtktextcellaccessible.c', - 'gtktextviewaccessible.c', - 'gtktogglebuttonaccessible.c', - 'gtktoplevelaccessible.c', - 'gtktreeviewaccessible.c', - 'gtkwidgetaccessible.c', - 'gtkwindowaccessible.c', -]) - -a11y_headers = files([ - 'gtk-a11y-autocleanups.h', - 'gtkbooleancellaccessible.h', - 'gtkbuttonaccessible.h', - 'gtkcellaccessible.h', - 'gtkcellaccessibleparent.h', - 'gtkcomboboxaccessible.h', - 'gtkcompositeaccessible.h', - 'gtkcontainercellaccessible.h', - 'gtkentryaccessible.h', - 'gtkexpanderaccessible.h', - 'gtkflowboxaccessible.h', - 'gtkflowboxchildaccessible.h', - 'gtkframeaccessible.h', - 'gtkiconviewaccessible.h', - 'gtkimageaccessible.h', - 'gtkimagecellaccessible.h', - 'gtklabelaccessible.h', - 'gtklevelbaraccessible.h', - 'gtklinkbuttonaccessible.h', - 'gtklistboxaccessible.h', - 'gtklistboxrowaccessible.h', - 'gtklockbuttonaccessible.h', - 'gtkmenubuttonaccessible.h', - 'gtknotebookaccessible.h', - 'gtknotebookpageaccessible.h', - 'gtkpanedaccessible.h', - 'gtkpasswordentryaccessible.h', - 'gtkpopoveraccessible.h', - 'gtkprogressbaraccessible.h', - 'gtkradiobuttonaccessible.h', - 'gtkrangeaccessible.h', - 'gtkrenderercellaccessible.h', - 'gtkscaleaccessible.h', - 'gtkscalebuttonaccessible.h', - 'gtkscrollbaraccessible.h', - 'gtkscrolledwindowaccessible.h', - 'gtksearchentryaccessible.h', - 'gtkspinbuttonaccessible.h', - 'gtkspinneraccessible.h', - 'gtkstackaccessible.h', - 'gtkstatusbaraccessible.h', - 'gtkswitchaccessible.h', - 'gtktextaccessible.h', - 'gtktextcellaccessible.h', - 'gtktextviewaccessible.h', - 'gtktogglebuttonaccessible.h', - 'gtktoplevelaccessible.h', - 'gtktreeviewaccessible.h', - 'gtkwidgetaccessible.h', - 'gtkwindowaccessible.h', -]) -install_headers(a11y_headers, subdir : 'gtk-4.0/gtk/a11y') diff --git a/gtk/gtk-a11y.h b/gtk/gtk-a11y.h deleted file mode 100644 index 3199b23156..0000000000 --- a/gtk/gtk-a11y.h +++ /dev/null @@ -1,85 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * 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 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/>. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __GTK_A11Y_H__ -#define __GTK_A11Y_H__ - -#define __GTK_A11Y_H_INSIDE__ - -#include <gtk/gtk.h> -#include <gtk/a11y/gtkbooleancellaccessible.h> -#include <gtk/a11y/gtkbuttonaccessible.h> -#include <gtk/a11y/gtkcellaccessible.h> -#include <gtk/a11y/gtkcellaccessibleparent.h> -#include <gtk/a11y/gtkcomboboxaccessible.h> -#include <gtk/a11y/gtkcompositeaccessible.h> -#include <gtk/a11y/gtkcontainercellaccessible.h> -#include <gtk/a11y/gtkentryaccessible.h> -#include <gtk/a11y/gtkexpanderaccessible.h> -#include <gtk/a11y/gtkflowboxaccessible.h> -#include <gtk/a11y/gtkflowboxchildaccessible.h> -#include <gtk/a11y/gtkframeaccessible.h> -#include <gtk/a11y/gtkiconviewaccessible.h> -#include <gtk/a11y/gtkimageaccessible.h> -#include <gtk/a11y/gtkimagecellaccessible.h> -#include <gtk/a11y/gtklabelaccessible.h> -#include <gtk/a11y/gtklevelbaraccessible.h> -#include <gtk/a11y/gtklinkbuttonaccessible.h> -#include <gtk/a11y/gtklistboxaccessible.h> -#include <gtk/a11y/gtklistboxrowaccessible.h> -#include <gtk/a11y/gtklockbuttonaccessible.h> -#include <gtk/a11y/gtkmenubuttonaccessible.h> -#include <gtk/a11y/gtknotebookaccessible.h> -#include <gtk/a11y/gtknotebookpageaccessible.h> -#include <gtk/a11y/gtkpanedaccessible.h> -#include <gtk/a11y/gtkpasswordentryaccessible.h> -#include <gtk/a11y/gtkpopoveraccessible.h> -#include <gtk/a11y/gtkprogressbaraccessible.h> -#include <gtk/a11y/gtkradiobuttonaccessible.h> -#include <gtk/a11y/gtkrangeaccessible.h> -#include <gtk/a11y/gtkrenderercellaccessible.h> -#include <gtk/a11y/gtkscaleaccessible.h> -#include <gtk/a11y/gtkscalebuttonaccessible.h> -#include <gtk/a11y/gtkscrolledwindowaccessible.h> -#include <gtk/a11y/gtkscrollbaraccessible.h> -#include <gtk/a11y/gtksearchentryaccessible.h> -#include <gtk/a11y/gtkspinbuttonaccessible.h> -#include <gtk/a11y/gtkspinneraccessible.h> -#include <gtk/a11y/gtkstackaccessible.h> -#include <gtk/a11y/gtkstatusbaraccessible.h> -#include <gtk/a11y/gtkswitchaccessible.h> -#include <gtk/a11y/gtktextaccessible.h> -#include <gtk/a11y/gtktextcellaccessible.h> -#include <gtk/a11y/gtktextviewaccessible.h> -#include <gtk/a11y/gtktogglebuttonaccessible.h> -#include <gtk/a11y/gtktoplevelaccessible.h> -#include <gtk/a11y/gtktreeviewaccessible.h> -#include <gtk/a11y/gtkwidgetaccessible.h> -#include <gtk/a11y/gtkwindowaccessible.h> - -#include <gtk/a11y/gtk-a11y-autocleanups.h> - -#undef __GTK_A11Y_H_INSIDE__ - -#endif /* __GTK_A11Y_H__ */ @@ -34,7 +34,6 @@ #include <gtk/gtkaboutdialog.h> #include <gtk/gtkaccelgroup.h> #include <gtk/gtkaccellabel.h> -#include <gtk/gtkaccessible.h> #include <gtk/gtkactionable.h> #include <gtk/gtkactionbar.h> #include <gtk/gtkadjustment.h> diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 2a498a907c..fc313b0e15 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -128,8 +128,6 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class) gobject_class->set_property = gtk_accel_label_set_property; gobject_class->get_property = gtk_accel_label_get_property; - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_ACCEL_LABEL); - props[PROP_LABEL] = g_param_spec_string ("label", P_("Label"), diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c deleted file mode 100644 index ae0ba101c0..0000000000 --- a/gtk/gtkaccessible.c +++ /dev/null @@ -1,215 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright 2001 Sun Microsystems Inc. - * Copyright 2020 GNOME Foundation - * - * 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 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/>. - */ - -#include "config.h" -#include <string.h> - -#include "gtkwidget.h" -#include "gtkintl.h" -#include "gtkaccessible.h" - -/** - * SECTION:gtkaccessible - * @Short_description: Accessibility support for widgets - * @Title: GtkAccessible - * - * The #GtkAccessible class is the base class for accessible - * implementations for #GtkWidget subclasses. It is a thin - * wrapper around #AtkObject, which adds facilities for associating - * a widget with its accessible object. - * - * An accessible implementation for a third-party widget should - * derive from #GtkAccessible and implement the suitable interfaces - * from ATK, such as #AtkText or #AtkSelection. To establish - * the connection between the widget class and its corresponding - * accessible implementation, override the get_accessible vfunc - * in #GtkWidgetClass. - */ - -typedef struct -{ - GtkWidget *widget; -} GtkAccessiblePrivate; - -enum -{ - PROP_0, - PROP_WIDGET -}; - -G_DEFINE_TYPE_WITH_PRIVATE (GtkAccessible, gtk_accessible, ATK_TYPE_OBJECT) - -static void -gtk_accessible_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GtkAccessible *accessible = GTK_ACCESSIBLE (object); - - switch (prop_id) - { - case PROP_WIDGET: - gtk_accessible_set_widget (accessible, g_value_get_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gtk_accessible_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GtkAccessible *accessible = GTK_ACCESSIBLE (object); - GtkAccessiblePrivate *priv = gtk_accessible_get_instance_private (accessible); - - switch (prop_id) - { - case PROP_WIDGET: - g_value_set_object (value, priv->widget); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gtk_accessible_init (GtkAccessible *accessible) -{ -} - -static AtkStateSet * -gtk_accessible_ref_state_set (AtkObject *object) -{ - GtkAccessible *accessible = GTK_ACCESSIBLE (object); - GtkAccessiblePrivate *priv = gtk_accessible_get_instance_private (accessible); - AtkStateSet *state_set; - - state_set = ATK_OBJECT_CLASS (gtk_accessible_parent_class)->ref_state_set (object); - - if (priv->widget == NULL) - atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT); - - return state_set; -} - -static void -gtk_accessible_real_widget_set (GtkAccessible *accessible) -{ - atk_object_notify_state_change (ATK_OBJECT (accessible), ATK_STATE_DEFUNCT, FALSE); -} - -static void -gtk_accessible_real_widget_unset (GtkAccessible *accessible) -{ - atk_object_notify_state_change (ATK_OBJECT (accessible), ATK_STATE_DEFUNCT, TRUE); -} - -static void -gtk_accessible_dispose (GObject *object) -{ - GtkAccessible *accessible = GTK_ACCESSIBLE (object); - - gtk_accessible_set_widget (accessible, NULL); - - G_OBJECT_CLASS (gtk_accessible_parent_class)->dispose (object); -} - -static void -gtk_accessible_class_init (GtkAccessibleClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass); - - klass->widget_set = gtk_accessible_real_widget_set; - klass->widget_unset = gtk_accessible_real_widget_unset; - - atkobject_class->ref_state_set = gtk_accessible_ref_state_set; - gobject_class->get_property = gtk_accessible_get_property; - gobject_class->set_property = gtk_accessible_set_property; - gobject_class->dispose = gtk_accessible_dispose; - - g_object_class_install_property (gobject_class, - PROP_WIDGET, - g_param_spec_object ("widget", - P_("Widget"), - P_("The widget referenced by this accessible."), - GTK_TYPE_WIDGET, - G_PARAM_READWRITE)); -} - -/** - * gtk_accessible_set_widget: - * @accessible: a #GtkAccessible - * @widget: (allow-none): a #GtkWidget or %NULL to unset - * - * Sets the #GtkWidget corresponding to the #GtkAccessible. - * - * @accessible will not hold a reference to @widget. - * It is the caller’s responsibility to ensure that when @widget - * is destroyed, the widget is unset by calling this function - * again with @widget set to %NULL. - */ -void -gtk_accessible_set_widget (GtkAccessible *accessible, - GtkWidget *widget) -{ - GtkAccessiblePrivate *priv = gtk_accessible_get_instance_private (accessible); - GtkAccessibleClass *klass; - - g_return_if_fail (GTK_IS_ACCESSIBLE (accessible)); - - if (priv->widget == widget) - return; - - klass = GTK_ACCESSIBLE_GET_CLASS (accessible); - if (priv->widget) - klass->widget_unset (accessible); - - priv->widget = widget; - if (priv->widget) - klass->widget_set (accessible); - - g_object_notify (G_OBJECT (accessible), "widget"); -} - -/** - * gtk_accessible_get_widget: - * @accessible: a #GtkAccessible - * - * Gets the #GtkWidget corresponding to the #GtkAccessible. - * The returned widget does not have a reference added, so - * you do not need to unref it. - * - * Returns: (nullable) (transfer none): pointer to the #GtkWidget - * corresponding to the #GtkAccessible, or %NULL. - */ -GtkWidget* -gtk_accessible_get_widget (GtkAccessible *accessible) -{ - GtkAccessiblePrivate *priv = gtk_accessible_get_instance_private (accessible); - - g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), NULL); - - return priv->widget; -} diff --git a/gtk/gtkaccessible.h b/gtk/gtkaccessible.h deleted file mode 100644 index 26125f0ca4..0000000000 --- a/gtk/gtkaccessible.h +++ /dev/null @@ -1,58 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright 2001 Sun Microsystems Inc. - * Copyright 2020 GNOME Foundation - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GTK_ACCESSIBLE_H__ -#define __GTK_ACCESSIBLE_H__ - -#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) -#error "Only <gtk/gtk.h> can be included directly." -#endif - -#include <atk/atk.h> -#include <gtk/gtkwidget.h> - -G_BEGIN_DECLS - -#define GTK_TYPE_ACCESSIBLE (gtk_accessible_get_type ()) - -#if !ATK_CHECK_VERSION(2, 37, 0) -G_DEFINE_AUTOPTR_CLEANUP_FUNC(AtkObject, g_object_unref) -#endif - -GDK_AVAILABLE_IN_ALL -G_DECLARE_DERIVABLE_TYPE (GtkAccessible, gtk_accessible, GTK, ACCESSIBLE, AtkObject) - -struct _GtkAccessibleClass -{ - AtkObjectClass parent_class; - - void (* widget_set) (GtkAccessible *accessible); - void (* widget_unset) (GtkAccessible *accessible); - - gpointer _padding[8]; -}; - -GDK_AVAILABLE_IN_ALL -void gtk_accessible_set_widget (GtkAccessible *accessible, - GtkWidget *widget); -GDK_AVAILABLE_IN_ALL -GtkWidget *gtk_accessible_get_widget (GtkAccessible *accessible); - -G_END_DECLS - -#endif /* __GTK_ACCESSIBLE_H__ */ diff --git a/gtk/gtkactionbar.c b/gtk/gtkactionbar.c index ae4393966a..6846f41cd7 100644 --- a/gtk/gtkactionbar.c +++ b/gtk/gtkactionbar.c @@ -21,7 +21,6 @@ #include "gtkactionbar.h" #include "gtkintl.h" -#include "gtkaccessible.h" #include "gtkbuildable.h" #include "gtktypebuiltins.h" #include "gtkbox.h" @@ -159,7 +158,6 @@ gtk_action_bar_class_init (GtkActionBarClass *klass) g_object_class_install_properties (object_class, LAST_PROP, props); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_PANEL); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("actionbar")); } diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index 558f5bda5f..27acfdf4f5 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -84,9 +84,6 @@ #include "gtkstylecontext.h" #include "gtktypebuiltins.h" -#include "a11y/gtkwindowaccessible.h" - - typedef struct _GtkAssistantPageClass GtkAssistantPageClass; struct _GtkAssistantPage @@ -206,8 +203,6 @@ static int gtk_assistant_add_page (GtkAssistant *assi GtkAssistantPage *page_info, int position); -GType _gtk_assistant_accessible_get_type (void); - enum { CHILD_PROP_0, @@ -487,8 +482,6 @@ gtk_assistant_class_init (GtkAssistantClass *class) widget_class->map = gtk_assistant_map; widget_class->unmap = gtk_assistant_unmap; - gtk_widget_class_set_accessible_type (widget_class, _gtk_assistant_accessible_get_type ()); - window_class->close_request = gtk_assistant_close_request; /** @@ -2092,89 +2085,6 @@ gtk_assistant_commit (GtkAssistant *assistant) update_buttons_state (assistant); } -/* accessible implementation */ - -/* dummy typedefs */ -typedef GtkWindowAccessible GtkAssistantAccessible; -typedef GtkWindowAccessibleClass GtkAssistantAccessibleClass; - -G_DEFINE_TYPE (GtkAssistantAccessible, _gtk_assistant_accessible, GTK_TYPE_WINDOW_ACCESSIBLE); - -static int -gtk_assistant_accessible_get_n_children (AtkObject *accessible) -{ - GtkWidget *widget; - GtkAssistant *assistant; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return 0; - - assistant = GTK_ASSISTANT (widget); - return g_list_length (assistant->pages) + 2; -} - -static AtkObject * -gtk_assistant_accessible_ref_child (AtkObject *accessible, - int index) -{ - GtkAssistant *assistant; - GtkWidget *widget, *child; - int n_pages; - AtkObject *obj; - const char *title; - - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - if (widget == NULL) - return NULL; - - assistant = GTK_ASSISTANT (widget); - n_pages = g_list_length (assistant->pages); - - if (index < 0) - return NULL; - else if (index < n_pages) - { - GtkAssistantPage *page = g_list_nth_data (assistant->pages, index); - - child = page->page; - title = gtk_assistant_get_page_title (assistant, child); - } - else if (index == n_pages) - { - child = assistant->action_area; - title = NULL; - } - else if (index == n_pages + 1) - { - child = assistant->headerbar; - title = NULL; - } - else - return NULL; - - obj = gtk_widget_get_accessible (child); - - if (title) - atk_object_set_name (obj, title); - - return g_object_ref (obj); -} - -static void -_gtk_assistant_accessible_class_init (GtkAssistantAccessibleClass *klass) -{ - AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); - - atk_class->get_n_children = gtk_assistant_accessible_get_n_children; - atk_class->ref_child = gtk_assistant_accessible_ref_child; -} - -static void -_gtk_assistant_accessible_init (GtkAssistantAccessible *self) -{ -} - /* buildable implementation */ static GtkBuildableIface *parent_buildable_iface; diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 11d430ffab..667f7f7ef5 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -278,7 +278,6 @@ gtk_box_class_init (GtkBoxClass *class) g_object_class_install_properties (object_class, LAST_PROP, props); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FILLER); gtk_widget_class_set_css_name (widget_class, I_("box")); } static void diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 7ed25e1699..f9fd20e0f5 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -71,8 +71,6 @@ #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkbuttonaccessible.h" - #include <string.h> /* Time out before giving up on getting a key release when animating @@ -292,7 +290,6 @@ gtk_button_class_init (GtkButtonClass *klass) widget_class->activate_signal = button_signals[ACTIVATE]; gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("button")); gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_space, 0, @@ -850,14 +847,6 @@ gtk_button_set_label (GtkButton *button, gtk_label_set_label (GTK_LABEL (priv->child), label); gtk_button_set_child_type (button, LABEL_CHILD); - { - GtkButtonAccessible *accessible = - GTK_BUTTON_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (button))); - - if (accessible != NULL) - gtk_button_accessible_update_label (accessible); - } - g_object_notify_by_pspec (G_OBJECT (button), props[PROP_LABEL]); } diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 0decdf544d..55c1bceec5 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -517,7 +517,6 @@ gtk_calendar_class_init (GtkCalendarClass *class) NULL, G_TYPE_NONE, 0); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_CALENDAR); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("calendar")); } diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c index 3df11d2bdd..b0dcdc9caf 100644 --- a/gtk/gtkcellrenderer.c +++ b/gtk/gtkcellrenderer.c @@ -27,9 +27,6 @@ #include "gtktreeprivate.h" #include "gtktypebuiltins.h" -#include "a11y/gtkrenderercellaccessible.h" - - /** * SECTION:gtkcellrenderer * @Short_description: An object for rendering a single cell @@ -138,11 +135,6 @@ struct _GtkCellRendererPrivate GdkRGBA cell_background; }; -struct _GtkCellRendererClassPrivate -{ - GType accessible_type; -}; - enum { PROP_0, PROP_MODE, @@ -425,16 +417,6 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class) if (GtkCellRenderer_private_offset != 0) g_type_class_adjust_private_offset (class, &GtkCellRenderer_private_offset); - - gtk_cell_renderer_class_set_accessible_type (class, GTK_TYPE_RENDERER_CELL_ACCESSIBLE); -} - -static void -gtk_cell_renderer_base_class_init (gpointer g_class) -{ - GtkCellRendererClass *klass = g_class; - - klass->priv = G_TYPE_CLASS_GET_PRIVATE (g_class, GTK_TYPE_CELL_RENDERER, GtkCellRendererClassPrivate); } GType @@ -447,7 +429,7 @@ gtk_cell_renderer_get_type (void) const GTypeInfo cell_renderer_info = { sizeof (GtkCellRendererClass), - gtk_cell_renderer_base_class_init, + NULL, NULL, (GClassInitFunc) gtk_cell_renderer_class_init, NULL, /* class_finalize */ @@ -462,7 +444,6 @@ gtk_cell_renderer_get_type (void) GtkCellRenderer_private_offset = g_type_add_instance_private (cell_renderer_type, sizeof (GtkCellRendererPrivate)); - g_type_add_class_private (cell_renderer_type, sizeof (GtkCellRendererClassPrivate)); } return cell_renderer_type; @@ -1776,39 +1757,3 @@ gtk_cell_renderer_get_is_expanded (GtkCellRenderer *cell) return priv->is_expanded; } - -/** - * gtk_cell_renderer_class_set_accessible_type: - * @renderer_class: class to set the accessible type for - * @type: The object type that implements the accessible for @widget_class. - * The type must be a subtype of #GtkRendererCellAccessible - * - * Sets the type to be used for creating accessibles for cells rendered by - * cell renderers of @renderer_class. Note that multiple accessibles will - * be created. - * - * This function should only be called from class init functions of cell - * renderers. - **/ -void -gtk_cell_renderer_class_set_accessible_type (GtkCellRendererClass *renderer_class, - GType type) -{ - GtkCellRendererClassPrivate *priv; - - g_return_if_fail (GTK_IS_CELL_RENDERER_CLASS (renderer_class)); - g_return_if_fail (g_type_is_a (type, GTK_TYPE_RENDERER_CELL_ACCESSIBLE)); - - priv = renderer_class->priv; - - priv->accessible_type = type; -} - -GType -_gtk_cell_renderer_get_accessible_type (GtkCellRenderer *renderer) -{ - g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), GTK_TYPE_RENDERER_CELL_ACCESSIBLE); - - return GTK_CELL_RENDERER_GET_CLASS (renderer)->priv->accessible_type; -} - diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h index 4be9b35552..353ca5ac3c 100644 --- a/gtk/gtkcellrenderer.h +++ b/gtk/gtkcellrenderer.h @@ -173,9 +173,6 @@ struct _GtkCellRendererClass const char *path); /*< private >*/ - - GtkCellRendererClassPrivate *priv; - gpointer padding[8]; }; @@ -317,13 +314,6 @@ GtkStateFlags gtk_cell_renderer_get_state (GtkCellRenderer *cell, GtkWidget *widget, GtkCellRendererState cell_state); -GDK_AVAILABLE_IN_ALL -void gtk_cell_renderer_class_set_accessible_type - (GtkCellRendererClass *renderer_class, - GType type); -GType _gtk_cell_renderer_get_accessible_type - (GtkCellRenderer * renderer); - G_END_DECLS #endif /* __GTK_CELL_RENDERER_H__ */ diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c index 81d1da83df..09763afed5 100644 --- a/gtk/gtkcellrendererpixbuf.c +++ b/gtk/gtkcellrendererpixbuf.c @@ -27,8 +27,6 @@ #include "gtkstylecontextprivate.h" #include "gtktypebuiltins.h" -#include "a11y/gtkimagecellaccessible.h" - #include <cairo-gobject.h> #include <stdlib.h> @@ -227,10 +225,6 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class) P_("The GIcon being displayed"), G_TYPE_ICON, GTK_PARAM_READWRITE)); - - - - gtk_cell_renderer_class_set_accessible_type (cell_class, GTK_TYPE_IMAGE_CELL_ACCESSIBLE); } static void diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c index e11e5c5fe6..2168129d3d 100644 --- a/gtk/gtkcellrenderertext.c +++ b/gtk/gtkcellrenderertext.c @@ -31,8 +31,6 @@ #include "gtkstylecontextprivate.h" #include "gtktreeprivate.h" -#include "a11y/gtktextcellaccessible.h" - #include <stdlib.h> /** @@ -642,8 +640,6 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class) g_signal_set_va_marshaller (text_cell_renderer_signals [EDITED], G_OBJECT_CLASS_TYPE (object_class), _gtk_marshal_VOID__STRING_STRINGv); - - gtk_cell_renderer_class_set_accessible_type (cell_class, GTK_TYPE_TEXT_CELL_ACCESSIBLE); } static void diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c index 50de7e4309..580a4e6080 100644 --- a/gtk/gtkcellrenderertoggle.c +++ b/gtk/gtkcellrenderertoggle.c @@ -29,8 +29,6 @@ #include "gtkwidgetprivate.h" #include "gtktreeprivate.h" -#include "a11y/gtkbooleancellaccessible.h" - #include <stdlib.h> /** @@ -216,8 +214,6 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class) NULL, G_TYPE_NONE, 1, G_TYPE_STRING); - - gtk_cell_renderer_class_set_accessible_type (cell_class, GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE); } static void diff --git a/gtk/gtkcenterbox.c b/gtk/gtkcenterbox.c index 3751ea5db3..c8deccf45f 100644 --- a/gtk/gtkcenterbox.c +++ b/gtk/gtkcenterbox.c @@ -209,7 +209,6 @@ gtk_center_box_class_init (GtkCenterBoxClass *klass) GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FILLER); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CENTER_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("box")); } diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 3799bc1b1e..2f89874a64 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -200,7 +200,6 @@ gtk_check_button_class_init (GtkCheckButtonClass *class) g_object_class_install_properties (object_class, NUM_PROPERTIES, props); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_CHECK_BOX); gtk_widget_class_set_css_name (widget_class, I_("checkbutton")); } diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c index 7727e40157..114a3db522 100644 --- a/gtk/gtkcolorchooserwidget.c +++ b/gtk/gtkcolorchooserwidget.c @@ -32,8 +32,6 @@ #include "gtkboxlayout.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkcompositeaccessible.h" - #include <math.h> /** @@ -265,31 +263,6 @@ update_from_editor (GtkColorEditor *editor, /* UI construction {{{1 */ -static guint -scale_round (double value, double scale) -{ - value = floor (value * scale + 0.5); - value = MAX (value, 0); - value = MIN (value, scale); - return (guint)value; -} - -static char * -accessible_color_name (GdkRGBA *color) -{ - if (color->alpha < 1.0) - return g_strdup_printf (_("Red %d%%, Green %d%%, Blue %d%%, Alpha %d%%"), - scale_round (color->red, 100), - scale_round (color->green, 100), - scale_round (color->blue, 100), - scale_round (color->alpha, 100)); - else - return g_strdup_printf (_("Red %d%%, Green %d%%, Blue %d%%"), - scale_round (color->red, 100), - scale_round (color->green, 100), - scale_round (color->blue, 100)); -} - static void remove_palette (GtkColorChooserWidget *cc) { @@ -326,7 +299,6 @@ add_palette (GtkColorChooserWidget *cc, { GtkWidget *grid; GtkWidget *p; - AtkObject *atk_obj; int line, pos; int i; int left, right; @@ -355,22 +327,6 @@ add_palette (GtkColorChooserWidget *cc, for (i = 0; i < n_colors; i++) { p = gtk_color_swatch_new (); - atk_obj = gtk_widget_get_accessible (p); - if (names) - { - atk_object_set_name (atk_obj, - g_dpgettext2 (GETTEXT_PACKAGE, "Color name", names[i])); - } - else - { - char *text, *name; - - name = accessible_color_name (&colors[i]); - text = g_strdup_printf (_("Color: %s"), name); - atk_object_set_name (atk_obj, text); - g_free (text); - g_free (name); - } gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (p), &colors[i]); connect_swatch_signals (p, cc); @@ -543,8 +499,6 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc) GVariant *variant; GVariantIter iter; gboolean selected; - AtkObject *atk_obj; - char *text, *name; cc->use_alpha = TRUE; @@ -564,9 +518,6 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc) cc->button = button = gtk_color_swatch_new (); gtk_widget_set_name (button, "add-color-button"); - atk_obj = gtk_widget_get_accessible (button); - atk_object_set_name (atk_obj, _("Custom color")); - atk_object_set_description (atk_obj, _("Create a custom color")); connect_button_signals (button, cc); gtk_color_swatch_set_icon (GTK_COLOR_SWATCH (button), "list-add-symbolic"); gtk_color_swatch_set_selectable (GTK_COLOR_SWATCH (button), FALSE); @@ -589,12 +540,6 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc) gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (p), &rgba); gtk_color_swatch_set_can_drop (GTK_COLOR_SWATCH (p), TRUE); - atk_obj = gtk_widget_get_accessible (p); - name = accessible_color_name (&rgba); - text = g_strdup_printf (_("Custom color %d: %s"), i, name); - atk_object_set_name (atk_obj, text); - g_free (text); - g_free (name); connect_custom_signals (p, cc); gtk_box_append (GTK_BOX (box), p); @@ -753,8 +698,6 @@ gtk_color_chooser_widget_class_init (GtkColorChooserWidgetClass *class) */ gtk_widget_class_install_action (widget_class, "color.customize", "(dddd)", gtk_color_chooser_widget_activate_color_customize); - - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_COMPOSITE_ACCESSIBLE); } /* GtkColorChooser implementation {{{1 */ diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c index 0aa56a2a8b..b75d2761a6 100644 --- a/gtk/gtkcolorplane.c +++ b/gtk/gtkcolorplane.c @@ -19,7 +19,6 @@ #include "gtkcolorplaneprivate.h" -#include "gtkaccessible.h" #include "gtkadjustment.h" #include "gtkcolorutils.h" #include "gtkgesturedrag.h" @@ -406,20 +405,12 @@ gtk_color_plane_init (GtkColorPlane *plane) { GtkEventController *controller; GtkGesture *gesture; - AtkObject *atk_obj; GtkShortcutTrigger *trigger; GtkShortcutAction *action; GtkShortcut *shortcut; gtk_widget_set_focusable (GTK_WIDGET (plane), TRUE); - atk_obj = gtk_widget_get_accessible (GTK_WIDGET (plane)); - if (GTK_IS_ACCESSIBLE (atk_obj)) - { - atk_object_set_name (atk_obj, _("Color Plane")); - atk_object_set_role (atk_obj, ATK_ROLE_COLOR_CHOOSER); - } - gesture = gtk_gesture_drag_new (); g_signal_connect (gesture, "drag-begin", G_CALLBACK (plane_drag_gesture_begin), plane); diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c index ec5d2c5367..90da05b8ec 100644 --- a/gtk/gtkcolorscale.c +++ b/gtk/gtkcolorscale.c @@ -25,7 +25,6 @@ #include "gtkcolorutils.h" #include "gtkorientable.h" #include "gtkrangeprivate.h" -#include "gtkaccessible.h" #include "gtkprivate.h" #include "gtkintl.h" #include "gtksnapshot.h" @@ -224,19 +223,8 @@ scale_set_type (GtkColorScale *scale, GtkColorScaleType type) { GtkColorScalePrivate *priv = gtk_color_scale_get_instance_private (scale); - AtkObject *atk_obj; priv->type = type; - - atk_obj = gtk_widget_get_accessible (GTK_WIDGET (scale)); - if (GTK_IS_ACCESSIBLE (atk_obj)) - { - if (type == GTK_COLOR_SCALE_HUE) - atk_object_set_name (atk_obj, C_("Color channel", "Hue")); - else if (type == GTK_COLOR_SCALE_ALPHA) - atk_object_set_name (atk_obj, C_("Color channel", "Alpha")); - atk_object_set_role (atk_obj, ATK_ROLE_COLOR_CHOOSER); - } } static void diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index 63688eb448..cafe71a281 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -40,8 +40,6 @@ #include "gtkeventcontrollerkey.h" #include "gtknative.h" -#include "a11y/gtkcolorswatchaccessibleprivate.h" - /* * GtkColorSwatch has two CSS nodes, the main one named colorswatch * and a subnode named overlay. The main node gets the .light or .dark @@ -506,7 +504,6 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class) "menu.popup", NULL); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_COLOR_SWATCH_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("colorswatch")); } diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 6c66f0a521..015fe479d6 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -39,8 +39,6 @@ #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkcomboboxaccessible.h" - #include <gobject/gvaluecollector.h> #include <string.h> #include <stdarg.h> @@ -798,7 +796,6 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_menu_show); gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_menu_hide); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_COMBO_BOX_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("combobox")); } @@ -2533,29 +2530,6 @@ gtk_combo_box_get_popup_fixed_width (GtkComboBox *combo_box) return priv->popup_fixed_width; } - -/** - * gtk_combo_box_get_popup_accessible: - * @combo_box: a #GtkComboBox - * - * Gets the accessible object corresponding to the combo box’s popup. - * - * This function is mostly intended for use by accessibility technologies; - * applications should have little use for it. - * - * Returns: (transfer none): the accessible object corresponding - * to the combo box’s popup. - */ -AtkObject* -gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box) -{ - GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box); - - g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL); - - return gtk_widget_get_accessible (priv->popup_widget); -} - /** * gtk_combo_box_get_row_separator_func: (skip) * @combo_box: a #GtkComboBox diff --git a/gtk/gtkcombobox.h b/gtk/gtkcombobox.h index c47a53ca2b..9631e2043e 100644 --- a/gtk/gtkcombobox.h +++ b/gtk/gtkcombobox.h @@ -135,8 +135,6 @@ void gtk_combo_box_popup_for_device (GtkComboBox *combo_box, GdkDevice *device); GDK_AVAILABLE_IN_ALL void gtk_combo_box_popdown (GtkComboBox *combo_box); -GDK_AVAILABLE_IN_ALL -AtkObject* gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box); GDK_AVAILABLE_IN_ALL int gtk_combo_box_get_id_column (GtkComboBox *combo_box); diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index d06ff6d918..13245c5890 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -486,8 +486,6 @@ gtk_dialog_class_init (GtkDialogClass *class) window_class->close_request = gtk_dialog_close_request; - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_DIALOG); - class->close = gtk_dialog_close; /** diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index b501f3b07c..7306869910 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -329,8 +329,6 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class) g_signal_set_va_marshaller (signals[RESIZE], G_TYPE_FROM_CLASS (class), _gtk_marshal_VOID__INT_INTv); - - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_DRAWING_AREA); } static void diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index d95c5f3b72..5c940fbb0a 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -70,8 +70,6 @@ #include "gtkdragicon.h" #include "gtkwidgetpaintable.h" -#include "a11y/gtkentryaccessible.h" - #include <cairo-gobject.h> #include <string.h> @@ -984,7 +982,6 @@ gtk_entry_class_init (GtkEntryClass *class) G_TYPE_NONE, 1, GTK_TYPE_ENTRY_ICON_POSITION); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("entry")); } diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index fb8782f639..d048112b93 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -2062,36 +2062,6 @@ connect_completion_signals (GtkEntryCompletion *completion) } static void -set_accessible_relation (GtkWidget *window, - GtkWidget *entry) -{ - AtkObject *window_accessible; - AtkObject *entry_accessible; - - window_accessible = gtk_widget_get_accessible (window); - entry_accessible = gtk_widget_get_accessible (entry); - - atk_object_add_relationship (window_accessible, - ATK_RELATION_POPUP_FOR, - entry_accessible); -} - -static void -unset_accessible_relation (GtkWidget *window, - GtkWidget *entry) -{ - AtkObject *window_accessible; - AtkObject *entry_accessible; - - window_accessible = gtk_widget_get_accessible (window); - entry_accessible = gtk_widget_get_accessible (entry); - - atk_object_remove_relationship (window_accessible, - ATK_RELATION_POPUP_FOR, - entry_accessible); -} - -static void disconnect_completion_signals (GtkEntryCompletion *completion) { GtkText *text = gtk_entry_get_text_widget (GTK_ENTRY (completion->entry)); @@ -2135,8 +2105,6 @@ _gtk_entry_completion_disconnect (GtkEntryCompletion *completion) disconnect_completion_signals (completion); - unset_accessible_relation (completion->popup_window, - completion->entry); gtk_widget_unparent (completion->popup_window); completion->entry = NULL; @@ -2148,8 +2116,6 @@ _gtk_entry_completion_connect (GtkEntryCompletion *completion, { completion->entry = GTK_WIDGET (entry); - set_accessible_relation (completion->popup_window, - completion->entry); gtk_widget_set_parent (completion->popup_window, GTK_WIDGET (entry)); connect_completion_signals (completion); diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index a5864d5f47..7993e506d4 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -126,8 +126,6 @@ #include "gtkstylecontextprivate.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkexpanderaccessibleprivate.h" - #include <string.h> #define TIMEOUT_EXPAND 500 @@ -375,7 +373,6 @@ gtk_expander_class_init (GtkExpanderClass *klass) NULL, G_TYPE_NONE, 0); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_EXPANDER_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("expander-widget")); } @@ -880,14 +877,6 @@ gtk_expander_set_expanded (GtkExpander *expander, gtk_expander_resize_toplevel (expander); } - { - AtkObject *accessible = _gtk_widget_peek_accessible (GTK_WIDGET (expander)); - - if (accessible != NULL) - gtk_expander_accessible_update_state (GTK_EXPANDER_ACCESSIBLE (accessible), - expander->expanded); - } - g_object_notify (G_OBJECT (expander), "expanded"); } @@ -941,13 +930,6 @@ gtk_expander_set_label (GtkExpander *expander, gtk_expander_set_label_widget (expander, child); } - { - AtkObject *accessible = _gtk_widget_peek_accessible (GTK_WIDGET (expander)); - - if (accessible != NULL) - gtk_expander_accessible_update_label (GTK_EXPANDER_ACCESSIBLE (accessible)); - } - g_object_notify (G_OBJECT (expander), "label"); } diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c index 54cb4cc015..9eebd2dae0 100644 --- a/gtk/gtkfilechooserdialog.c +++ b/gtk/gtkfilechooserdialog.c @@ -293,8 +293,6 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class) widget_class->unmap = gtk_file_chooser_dialog_unmap; widget_class->size_allocate = gtk_file_chooser_dialog_size_allocate; - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FILE_CHOOSER); - _gtk_file_chooser_install_properties (gobject_class); /* Bind class to template diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index 169e18d4a7..ef4aaf809b 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -98,9 +98,6 @@ #include "gtkviewport.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkflowboxaccessibleprivate.h" -#include "a11y/gtkflowboxchildaccessible.h" - /* Forward declarations and utilities {{{1 */ static void gtk_flow_box_update_cursor (GtkFlowBox *box, @@ -537,7 +534,6 @@ gtk_flow_box_child_class_init (GtkFlowBoxChildClass *class) widget_class->activate_signal = child_signals[CHILD_ACTIVATE]; gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_LIST_ITEM); gtk_widget_class_set_css_name (widget_class, I_("flowboxchild")); } @@ -961,7 +957,6 @@ gtk_flow_box_update_cursor (GtkFlowBox *box, { BOX_PRIV (box)->cursor_child = child; gtk_widget_grab_focus (GTK_WIDGET (child)); - _gtk_flow_box_accessible_update_cursor (GTK_WIDGET (box), GTK_WIDGET (child)); } static void @@ -3379,7 +3374,6 @@ gtk_flow_box_move_cursor (GtkFlowBox *box, static void gtk_flow_box_selected_children_changed (GtkFlowBox *box) { - _gtk_flow_box_accessible_selection_changed (GTK_WIDGET (box)); } /* GObject implementation {{{2 */ @@ -3877,7 +3871,6 @@ gtk_flow_box_class_init (GtkFlowBoxClass *class) "unselect-all", NULL); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_FLOW_BOX_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("flowbox")); } diff --git a/gtk/gtkfontchooserdialog.c b/gtk/gtkfontchooserdialog.c index b31fd4059e..6181db6836 100644 --- a/gtk/gtkfontchooserdialog.c +++ b/gtk/gtkfontchooserdialog.c @@ -21,8 +21,6 @@ #include <glib/gprintf.h> #include <string.h> -#include <atk/atk.h> - #include "gtkfontchooserdialog.h" #include "gtkfontchooser.h" #include "gtkfontchooserwidget.h" @@ -30,7 +28,6 @@ #include "gtkfontchooserutils.h" #include "gtkbox.h" #include "gtkintl.h" -#include "gtkaccessible.h" #include "gtkbuildable.h" #include "gtkprivate.h" #include "gtkwidget.h" diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index e56b13ad42..fcdf19192b 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -21,8 +21,6 @@ #include <glib/gprintf.h> #include <string.h> -#include <atk/atk.h> - #include "gtkfontchooserwidget.h" #include "gtkfontchooserwidgetprivate.h" diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c index efa8ddcec1..bd904a57fd 100644 --- a/gtk/gtkframe.c +++ b/gtk/gtkframe.c @@ -36,8 +36,6 @@ #include "gtkcssstylepropertyprivate.h" #include "gtklabel.h" -#include "a11y/gtkframeaccessible.h" - /** * SECTION:gtkframe * @Short_description: A widget with a decorative frame and optional label @@ -194,7 +192,6 @@ gtk_frame_class_init (GtkFrameClass *class) g_object_class_install_properties (gobject_class, LAST_PROP, frame_props); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_FRAME_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("frame")); } diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c index ddb079c9e9..09b4d35fff 100644 --- a/gtk/gtkglarea.c +++ b/gtk/gtkglarea.c @@ -784,8 +784,6 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass) widget_class->size_allocate = gtk_gl_area_size_allocate; widget_class->snapshot = gtk_gl_area_snapshot; - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_DRAWING_AREA); - /** * GtkGLArea:context: * diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c index 9e6a91f3b4..d2ce3fb3a3 100644 --- a/gtk/gtkheaderbar.c +++ b/gtk/gtkheaderbar.c @@ -599,7 +599,6 @@ gtk_header_bar_class_init (GtkHeaderBarClass *class) g_object_class_install_properties (object_class, LAST_PROP, header_bar_props); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_PANEL); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("headerbar")); } diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index c80c43fe22..57e3404cc9 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -19,7 +19,6 @@ #include "gtkiconviewprivate.h" -#include "gtkaccessible.h" #include "gtkadjustmentprivate.h" #include "gtkcellareabox.h" #include "gtkcellareacontext.h" @@ -48,8 +47,6 @@ #include "gtkdragicon.h" #include "gtknative.h" -#include "a11y/gtkiconviewaccessibleprivate.h" - #include <string.h> /** @@ -256,9 +253,6 @@ static void gtk_icon_view_ensure_cell_area (GtkIco static GtkCellArea *gtk_icon_view_cell_layout_get_area (GtkCellLayout *layout); -static void gtk_icon_view_item_selected_changed (GtkIconView *icon_view, - GtkIconViewItem *item); - static void gtk_icon_view_add_editable (GtkCellArea *area, GtkCellRenderer *renderer, GtkCellEditable *editable, @@ -885,7 +879,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass) gtk_icon_view_add_move_binding (widget_class, GDK_KEY_KP_Left, 0, GTK_MOVEMENT_VISUAL_POSITIONS, -1); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ICON_VIEW_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("iconview")); } @@ -1917,25 +1910,6 @@ gtk_icon_view_remove (GtkIconView *icon_view, } } -static void -gtk_icon_view_item_selected_changed (GtkIconView *icon_view, - GtkIconViewItem *item) -{ - AtkObject *obj; - AtkObject *item_obj; - - obj = gtk_widget_get_accessible (GTK_WIDGET (icon_view)); - if (obj != NULL) - { - item_obj = atk_object_ref_accessible_child (obj, item->index); - if (item_obj != NULL) - { - atk_object_notify_state_change (item_obj, ATK_STATE_SELECTED, item->selected); - g_object_unref (item_obj); - } - } -} - static void gtk_icon_view_add_editable (GtkCellArea *area, GtkCellRenderer *renderer, @@ -2472,7 +2446,6 @@ gtk_icon_view_unselect_all_internal (GtkIconView *icon_view) item->selected = FALSE; dirty = TRUE; gtk_icon_view_queue_draw_item (icon_view, item); - gtk_icon_view_item_selected_changed (icon_view, item); } } @@ -2551,7 +2524,6 @@ gtk_icon_view_real_toggle_cursor_item (GtkIconView *icon_view) icon_view->priv->cursor_item->selected = !icon_view->priv->cursor_item->selected; g_signal_emit (icon_view, icon_view_signals[SELECTION_CHANGED], 0); - gtk_icon_view_item_selected_changed (icon_view, icon_view->priv->cursor_item); gtk_icon_view_queue_draw_item (icon_view, icon_view->priv->cursor_item); break; } @@ -2686,14 +2658,8 @@ gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment, if (gtk_widget_get_realized (widget)) { - GtkIconViewAccessible *accessible = - GTK_ICON_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (icon_view))); - if (icon_view->priv->doing_rubberband) gtk_icon_view_update_rubberband (icon_view); - - if (accessible != NULL) - gtk_icon_view_accessible_adjustment_changed (accessible); } gtk_widget_queue_draw (GTK_WIDGET (icon_view)); @@ -2982,14 +2948,9 @@ _gtk_icon_view_set_cursor_item (GtkIconView *icon_view, GtkIconViewItem *item, GtkCellRenderer *cursor_cell) { - AtkObject *obj; - AtkObject *item_obj; - AtkObject *cursor_item_obj; - - /* When hitting this path from keynav, the focus cell is - * already set, we dont need to notify the atk object - * but we still need to queue the draw here (in the case - * that the focus cell changes but not the cursor item). + /* When hitting this path from keynav, the focus cell is already set, + * but we still need to queue the draw here (in the case that the focus + * cell changes but not the cursor item). */ gtk_icon_view_queue_draw_item (icon_view, item); @@ -2997,17 +2958,9 @@ _gtk_icon_view_set_cursor_item (GtkIconView *icon_view, (cursor_cell == NULL || cursor_cell == gtk_cell_area_get_focus_cell (icon_view->priv->cell_area))) return; - obj = gtk_widget_get_accessible (GTK_WIDGET (icon_view)); if (icon_view->priv->cursor_item != NULL) - { - gtk_icon_view_queue_draw_item (icon_view, icon_view->priv->cursor_item); - if (obj != NULL) - { - cursor_item_obj = atk_object_ref_accessible_child (obj, icon_view->priv->cursor_item->index); - if (cursor_item_obj != NULL) - atk_object_notify_state_change (cursor_item_obj, ATK_STATE_FOCUSED, FALSE); - } - } + gtk_icon_view_queue_draw_item (icon_view, icon_view->priv->cursor_item); + icon_view->priv->cursor_item = item; if (cursor_cell) @@ -3018,18 +2971,6 @@ _gtk_icon_view_set_cursor_item (GtkIconView *icon_view, if (!gtk_cell_area_get_focus_cell (icon_view->priv->cell_area)) gtk_cell_area_focus (icon_view->priv->cell_area, GTK_DIR_TAB_FORWARD); } - - /* Notify that accessible focus object has changed */ - item_obj = atk_object_ref_accessible_child (obj, item->index); - - if (item_obj != NULL) - { - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - atk_focus_tracker_notify (item_obj); - G_GNUC_END_IGNORE_DEPRECATIONS; - atk_object_notify_state_change (item_obj, ATK_STATE_FOCUSED, TRUE); - g_object_unref (item_obj); - } } @@ -3122,7 +3063,6 @@ _gtk_icon_view_select_item (GtkIconView *icon_view, item->selected = TRUE; - gtk_icon_view_item_selected_changed (icon_view, item); g_signal_emit (icon_view, icon_view_signals[SELECTION_CHANGED], 0); gtk_icon_view_queue_draw_item (icon_view, item); @@ -3145,7 +3085,6 @@ _gtk_icon_view_unselect_item (GtkIconView *icon_view, item->selected = FALSE; - gtk_icon_view_item_selected_changed (icon_view, item); g_signal_emit (icon_view, icon_view_signals[SELECTION_CHANGED], 0); gtk_icon_view_queue_draw_item (icon_view, item); @@ -3582,7 +3521,6 @@ gtk_icon_view_select_all_between (GtkIconView *icon_view, { dirty = TRUE; item->selected = TRUE; - gtk_icon_view_item_selected_changed (icon_view, item); } gtk_icon_view_queue_draw_item (icon_view, item); } @@ -4713,14 +4651,6 @@ gtk_icon_view_set_model (GtkIconView *icon_view, gtk_icon_view_build_items (icon_view); } - { - GtkIconViewAccessible *accessible = - GTK_ICON_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (icon_view))); - - if (accessible != NULL) - gtk_icon_view_accessible_update_model (accessible, icon_view->priv->model); - } - g_object_notify (G_OBJECT (icon_view), "model"); if (dirty) diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 2534bb933d..e03cc45f06 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -36,8 +36,6 @@ #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkimageaccessible.h" - #include <math.h> #include <string.h> #include <cairo-gobject.h> @@ -262,7 +260,6 @@ gtk_image_class_init (GtkImageClass *class) g_object_class_install_properties (gobject_class, NUM_PROPERTIES, image_props); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_IMAGE_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("image")); } diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c index aa4f6f0726..54e2120fa9 100644 --- a/gtk/gtkinfobar.c +++ b/gtk/gtkinfobar.c @@ -32,7 +32,6 @@ #include <stdlib.h> #include "gtkinfobar.h" -#include "gtkaccessible.h" #include "gtkbuildable.h" #include "gtkbuilderprivate.h" #include "gtkbox.h" @@ -1072,7 +1071,6 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar, if (info_bar->message_type != message_type) { - AtkObject *atk_obj; const char *type_class[] = { GTK_STYLE_CLASS_INFO, GTK_STYLE_CLASS_WARNING, @@ -1088,43 +1086,6 @@ gtk_info_bar_set_message_type (GtkInfoBar *info_bar, gtk_widget_queue_draw (GTK_WIDGET (info_bar)); - atk_obj = gtk_widget_get_accessible (GTK_WIDGET (info_bar)); - if (GTK_IS_ACCESSIBLE (atk_obj)) - { - const char *name = NULL; - - atk_object_set_role (atk_obj, ATK_ROLE_INFO_BAR); - - switch (message_type) - { - case GTK_MESSAGE_INFO: - name = _("Information"); - break; - - case GTK_MESSAGE_QUESTION: - name = _("Question"); - break; - - case GTK_MESSAGE_WARNING: - name = _("Warning"); - break; - - case GTK_MESSAGE_ERROR: - name = _("Error"); - break; - - case GTK_MESSAGE_OTHER: - break; - - default: - g_warning ("Unknown GtkMessageType %u", message_type); - break; - } - - if (name) - atk_object_set_name (atk_obj, name); - } - if (type_class[info_bar->message_type]) gtk_widget_add_css_class (GTK_WIDGET (info_bar), type_class[info_bar->message_type]); diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index b1926f45c6..ae671f0885 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -58,8 +58,6 @@ #include "gtkdragicon.h" #include "gtkcsscolorvalueprivate.h" -#include "a11y/gtklabelaccessibleprivate.h" - #include <math.h> #include <string.h> @@ -1074,8 +1072,6 @@ gtk_label_class_init (GtkLabelClass *class) "activate-current-link", NULL); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LABEL_ACCESSIBLE); - gtk_widget_class_set_css_name (widget_class, I_("label")); quark_mnemonics_visible_connected = g_quark_from_static_string ("gtk-label-mnemonics-visible-connected"); @@ -1690,12 +1686,9 @@ gtk_label_set_text_internal (GtkLabel *self, return; } - _gtk_label_accessible_text_deleted (self); g_free (self->text); self->text = str; - _gtk_label_accessible_text_inserted (self); - gtk_label_select_region_index (self, 0, 0); } @@ -2291,7 +2284,6 @@ gtk_label_set_markup_internal (GtkLabel *self, gtk_label_ensure_select_info (self); self->select_info->links = g_steal_pointer (&links); self->select_info->n_links = n_links; - _gtk_label_accessible_update_links (self); gtk_label_ensure_has_tooltip (self); gtk_widget_add_css_class (GTK_WIDGET (self), "link"); } @@ -3744,7 +3736,6 @@ gtk_label_grab_focus (GtkWidget *widget) { self->select_info->selection_anchor = link->start; self->select_info->selection_end = link->start; - _gtk_label_accessible_focus_link_changed (self); break; } } @@ -3778,7 +3769,6 @@ gtk_label_focus (GtkWidget *widget, { info->selection_anchor = focus_link->start; info->selection_end = focus_link->start; - _gtk_label_accessible_focus_link_changed (self); } } } @@ -3813,7 +3803,6 @@ gtk_label_focus (GtkWidget *widget, if (!range_is_in_ellipsis (self, link->start, link->end)) { gtk_label_select_region_index (self, link->start, link->start); - _gtk_label_accessible_focus_link_changed (self); return TRUE; } } @@ -3831,7 +3820,6 @@ gtk_label_focus (GtkWidget *widget, if (!range_is_in_ellipsis (self, link->start, link->end)) { gtk_label_select_region_index (self, link->start, link->start); - _gtk_label_accessible_focus_link_changed (self); return TRUE; } } @@ -3897,7 +3885,6 @@ gtk_label_focus (GtkWidget *widget, focus_link = &info->links[new_index]; info->selection_anchor = focus_link->start; info->selection_end = focus_link->start; - _gtk_label_accessible_focus_link_changed (self); gtk_widget_queue_draw (widget); return TRUE; @@ -4509,8 +4496,6 @@ gtk_label_set_selectable (GtkLabel *self, { g_object_freeze_notify (G_OBJECT (self)); g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_SELECTABLE]); - _gtk_label_accessible_selection_bound_changed (self); - _gtk_label_accessible_cursor_position_changed (self); g_object_thaw_notify (G_OBJECT (self)); gtk_widget_queue_draw (GTK_WIDGET (self)); } @@ -4538,8 +4523,6 @@ gtk_label_select_region_index (GtkLabel *self, int end_index) { g_return_if_fail (GTK_IS_LABEL (self)); - gboolean anchor_changed; - gboolean bound_changed; if (self->select_info && self->select_info->selectable) { @@ -4605,17 +4588,9 @@ gtk_label_select_region_index (GtkLabel *self, g_object_freeze_notify (G_OBJECT (self)); - anchor_changed = self->select_info->selection_anchor != anchor_index; - bound_changed = self->select_info->selection_end != end_index; - self->select_info->selection_anchor = anchor_index; self->select_info->selection_end = end_index; - if (anchor_changed) - _gtk_label_accessible_selection_bound_changed (self); - if (bound_changed) - _gtk_label_accessible_cursor_position_changed (self); - clipboard = gtk_widget_get_primary_clipboard (GTK_WIDGET (self)); if (anchor_index != end_index) @@ -5505,8 +5480,6 @@ gtk_label_clear_links (GtkLabel *self) self->select_info->n_links = 0; self->select_info->active_link = NULL; gtk_widget_remove_css_class (GTK_WIDGET (self), "link"); - - _gtk_label_accessible_update_links (self); } static gboolean diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c index ace50c2202..b0e286fff3 100644 --- a/gtk/gtklevelbar.c +++ b/gtk/gtklevelbar.c @@ -133,8 +133,6 @@ #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtklevelbaraccessible.h" - #include <math.h> #include <stdlib.h> @@ -1007,7 +1005,6 @@ gtk_level_bar_class_init (GtkLevelBarClass *klass) g_object_class_install_properties (oclass, LAST_PROPERTY, properties); - gtk_widget_class_set_accessible_type (wclass, GTK_TYPE_LEVEL_BAR_ACCESSIBLE); gtk_widget_class_set_layout_manager_type (wclass, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_set_css_name (wclass, I_("levelbar")); } diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index 155f43450c..df25f264ae 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -68,8 +68,6 @@ #include "gtktooltip.h" #include "gtkwidgetprivate.h" -#include "a11y/gtklinkbuttonaccessible.h" - #include <string.h> typedef struct _GtkLinkButtonClass GtkLinkButtonClass; @@ -218,7 +216,6 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass) _gtk_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LINK_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("button")); /** diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index 3d3a1a720a..fb06f24ed4 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -33,9 +33,6 @@ #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtklistboxaccessibleprivate.h" -#include "a11y/gtklistboxrowaccessible.h" - #include <float.h> #include <math.h> #include <string.h> @@ -678,8 +675,6 @@ gtk_list_box_class_init (GtkListBoxClass *klass) NULL); gtk_widget_class_set_css_name (widget_class, I_("list")); - - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LIST_BOX_ACCESSIBLE); } static void @@ -902,7 +897,6 @@ gtk_list_box_unselect_all (GtkListBox *box) static void gtk_list_box_selected_rows_changed (GtkListBox *box) { - _gtk_list_box_accessible_selection_changed (box); } /** @@ -1524,7 +1518,6 @@ gtk_list_box_update_cursor (GtkListBox *box, gtk_widget_grab_focus (GTK_WIDGET (row)); } gtk_widget_queue_draw (GTK_WIDGET (row)); - _gtk_list_box_accessible_update_cursor (box, row); } static GtkListBox * @@ -3463,7 +3456,6 @@ gtk_list_box_row_class_init (GtkListBoxRowClass *klass) g_object_class_override_property (object_class, ROW_PROP_ACTION_TARGET, "action-target"); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("row")); } diff --git a/gtk/gtklockbutton.c b/gtk/gtklockbutton.c index bdca740d7b..c831306657 100644 --- a/gtk/gtklockbutton.c +++ b/gtk/gtklockbutton.c @@ -28,8 +28,6 @@ #include "gtkstack.h" #include "gtkstylecontext.h" -#include "a11y/gtklockbuttonaccessibleprivate.h" - /** * SECTION:gtklockbutton * @title: GtkLockButton @@ -198,12 +196,10 @@ gtk_lock_button_set_property (GObject *object, case PROP_TEXT_LOCK: gtk_label_set_text (GTK_LABEL (button->label_lock), g_value_get_string (value)); - _gtk_lock_button_accessible_name_changed (button); break; case PROP_TEXT_UNLOCK: gtk_label_set_text (GTK_LABEL (button->label_unlock), g_value_get_string (value)); - _gtk_lock_button_accessible_name_changed (button); break; case PROP_TOOLTIP_LOCK: @@ -326,7 +322,6 @@ gtk_lock_button_class_init (GtkLockButtonClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkLockButton, label_unlock); gtk_widget_class_bind_template_child (widget_class, GtkLockButton, stack); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LOCK_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("button")); } @@ -390,7 +385,6 @@ update_state (GtkLockButton *button) gtk_image_set_from_gicon (GTK_IMAGE (button->image), icon); gtk_stack_set_visible_child (GTK_STACK (button->stack), allowed ? button->label_lock : button->label_unlock); - _gtk_lock_button_accessible_name_changed (button); gtk_widget_set_tooltip_markup (GTK_WIDGET (button), tooltip); gtk_widget_set_sensitive (GTK_WIDGET (button), sensitive); gtk_widget_set_visible (GTK_WIDGET (button), visible); diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index e33e73cd83..6d2f3cf3b1 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -134,7 +134,6 @@ #include "gtkroot.h" #include "gtknative.h" -#include "a11y/gtkaccessibility.h" #include "inspector/window.h" #define GDK_ARRAY_ELEMENT_TYPE GtkWidget * @@ -644,7 +643,6 @@ static void default_display_notify_cb (GdkDisplayManager *dm) { debug_flags[0].display = gdk_display_get_default (); - _gtk_accessibility_init (); } static void diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c index 9a8b854437..22829e18cb 100644 --- a/gtk/gtkmenubutton.c +++ b/gtk/gtkmenubutton.c @@ -110,7 +110,6 @@ #include "config.h" -#include "gtkaccessible.h" #include "gtkactionable.h" #include "gtkimage.h" #include "gtkintl.h" @@ -128,8 +127,6 @@ #include "gtkbuttonprivate.h" #include "gtknative.h" -#include "a11y/gtkmenubuttonaccessible.h" - typedef struct _GtkMenuButtonClass GtkMenuButtonClass; typedef struct _GtkMenuButtonPrivate GtkMenuButtonPrivate; @@ -420,7 +417,6 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass) g_object_class_install_properties (gobject_class, LAST_PROP, menu_button_props); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_MENU_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("menubutton")); } diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index 0f4b49f20d..e9d5ab6668 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -27,7 +27,6 @@ #include "gtkmessagedialog.h" -#include "gtkaccessible.h" #include "gtkbox.h" #include "gtkbuildable.h" #include "gtkdialogprivate.h" @@ -150,8 +149,6 @@ gtk_message_dialog_class_init (GtkMessageDialogClass *class) widget_class = GTK_WIDGET_CLASS (class); gobject_class = G_OBJECT_CLASS (class); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_ALERT); - gobject_class->constructed = gtk_message_dialog_constructed; gobject_class->set_property = gtk_message_dialog_set_property; gobject_class->get_property = gtk_message_dialog_get_property; @@ -287,48 +284,12 @@ setup_type (GtkMessageDialog *dialog, GtkMessageType type) { GtkMessageDialogPrivate *priv = gtk_message_dialog_get_instance_private (dialog); - const char *name = NULL; - AtkObject *atk_obj; if (priv->message_type == type) return; priv->message_type = type; - switch (type) - { - case GTK_MESSAGE_INFO: - name = _("Information"); - break; - - case GTK_MESSAGE_QUESTION: - name = _("Question"); - break; - - case GTK_MESSAGE_WARNING: - name = _("Warning"); - break; - - case GTK_MESSAGE_ERROR: - name = _("Error"); - break; - - case GTK_MESSAGE_OTHER: - break; - - default: - g_warning ("Unknown GtkMessageType %u", type); - break; - } - - atk_obj = gtk_widget_get_accessible (GTK_WIDGET (dialog)); - if (GTK_IS_ACCESSIBLE (atk_obj)) - { - atk_object_set_role (atk_obj, ATK_ROLE_ALERT); - if (name) - atk_object_set_name (atk_obj, name); - } - g_object_notify (G_OBJECT (dialog), "message-type"); } diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c index c577accb6b..815493a994 100644 --- a/gtk/gtkmodelbutton.c +++ b/gtk/gtkmodelbutton.c @@ -421,15 +421,6 @@ gtk_model_button_update_state (GtkModelButton *self) indicator_state = get_start_indicator_state (self); if (self->iconic) gtk_widget_set_state_flags (GTK_WIDGET (self), indicator_state, TRUE); - - if (self->role == GTK_BUTTON_ROLE_CHECK || - self->role == GTK_BUTTON_ROLE_RADIO) - { - AtkObject *object = _gtk_widget_peek_accessible (GTK_WIDGET (self)); - if (object) - atk_object_notify_state_change (object, ATK_STATE_CHECKED, - (indicator_state & GTK_STATE_FLAG_CHECKED)); - } } static void @@ -456,21 +447,16 @@ gtk_model_button_direction_changed (GtkWidget *widget, static void update_node_name (GtkModelButton *self) { - AtkObject *accessible; - AtkRole a11y_role; const char *start_name; const char *end_name; - accessible = gtk_widget_get_accessible (GTK_WIDGET (self)); switch (self->role) { case GTK_BUTTON_ROLE_TITLE: - a11y_role = ATK_ROLE_PUSH_BUTTON; start_name = "arrow"; end_name = NULL; break; case GTK_BUTTON_ROLE_NORMAL: - a11y_role = ATK_ROLE_PUSH_BUTTON; start_name = NULL; if (self->menu_name || self->popover) end_name = "arrow"; @@ -479,13 +465,11 @@ update_node_name (GtkModelButton *self) break; case GTK_BUTTON_ROLE_CHECK: - a11y_role = ATK_ROLE_CHECK_BOX; start_name = "check"; end_name = NULL; break; case GTK_BUTTON_ROLE_RADIO: - a11y_role = ATK_ROLE_RADIO_BUTTON; start_name = "radio"; end_name = NULL; break; @@ -500,8 +484,6 @@ update_node_name (GtkModelButton *self) end_name = NULL; } - atk_object_set_role (accessible, a11y_role); - if (start_name && !self->start_indicator) { self->start_indicator = gtk_builtin_icon_new (start_name); @@ -1067,18 +1049,6 @@ gtk_model_button_focus (GtkWidget *widget, return FALSE; } -static AtkObject * -gtk_model_button_get_accessible (GtkWidget *widget) -{ - AtkObject *object; - - object = GTK_WIDGET_CLASS (gtk_model_button_parent_class)->get_accessible (widget); - - gtk_model_button_update_state (GTK_MODEL_BUTTON (widget)); - - return object; -} - static void gtk_model_button_class_init (GtkModelButtonClass *class) { @@ -1093,7 +1063,6 @@ gtk_model_button_class_init (GtkModelButtonClass *class) widget_class->state_flags_changed = gtk_model_button_state_flags_changed; widget_class->direction_changed = gtk_model_button_direction_changed; widget_class->focus = gtk_model_button_focus; - widget_class->get_accessible = gtk_model_button_get_accessible; class->clicked = gtk_model_button_clicked; @@ -1231,7 +1200,6 @@ gtk_model_button_class_init (GtkModelButtonClass *class) widget_class->activate_signal = signals[SIGNAL_CLICKED]; - gtk_widget_class_set_accessible_role (GTK_WIDGET_CLASS (class), ATK_ROLE_PUSH_BUTTON); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (class), I_("modelbutton")); } diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index fea2d3064d..ddcb9d64b9 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -55,8 +55,6 @@ #include "gtkwidgetpaintable.h" #include "gtknative.h" -#include "a11y/gtknotebookaccessibleprivate.h" - #include <stdio.h> #include <string.h> #include <math.h> @@ -1364,7 +1362,6 @@ gtk_notebook_class_init (GtkNotebookClass *class) add_tab_bindings (widget_class, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD); add_tab_bindings (widget_class, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_NOTEBOOK_ACCESSIBLE); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("notebook")); } @@ -5292,7 +5289,6 @@ gtk_notebook_real_switch_page (GtkNotebook *notebook, { GList *list = gtk_notebook_find_child (notebook, GTK_WIDGET (child)); GtkNotebookPage *page = GTK_NOTEBOOK_PAGE_FROM_LIST (list); - AtkObject *accessible; gboolean child_has_focus; if (notebook->cur_page == page || !gtk_widget_get_visible (GTK_WIDGET (child))) @@ -5338,11 +5334,6 @@ gtk_notebook_real_switch_page (GtkNotebook *notebook, update_arrow_state (notebook); - accessible = _gtk_widget_peek_accessible (GTK_WIDGET (notebook)); - if (accessible != NULL) - gtk_notebook_accessible_update_page (GTK_NOTEBOOK_ACCESSIBLE (accessible), - gtk_notebook_get_current_page (notebook)); - gtk_widget_queue_resize (GTK_WIDGET (notebook)); gtk_widget_queue_resize (notebook->tabs_widget); g_object_notify_by_pspec (G_OBJECT (notebook), properties[PROP_PAGE]); diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index a8873a6293..83b6e280b6 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -44,8 +44,6 @@ #include "gtkcssboxesprivate.h" #include "gtkbuildable.h" -#include "a11y/gtkpanedaccessible.h" - #include <math.h> /** @@ -775,7 +773,6 @@ gtk_paned_class_init (GtkPanedClass *class) add_move_binding (widget_class, GDK_KEY_End, 0, GTK_SCROLL_END); add_move_binding (widget_class, GDK_KEY_KP_End, 0, GTK_SCROLL_END); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_PANED_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("paned")); } diff --git a/gtk/gtkpango.c b/gtk/gtkpango.c index f8b0a54866..58c43c8cf2 100644 --- a/gtk/gtkpango.c +++ b/gtk/gtkpango.c @@ -28,1023 +28,6 @@ #include "gtkintl.h" #include "gtkbuilderprivate.h" -static AtkAttributeSet * -add_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - const char *value) -{ - AtkAttribute *at; - - at = g_new (AtkAttribute, 1); - at->name = g_strdup (atk_text_attribute_get_name (attr)); - at->value = g_strdup (value); - - return g_slist_prepend (attributes, at); -} - -/* - * _gtk_pango_get_default_attributes: - * @attributes: a #AtkAttributeSet to add the attributes to - * @layout: the #PangoLayout from which to get attributes - * - * Adds the default text attributes from @layout to @attributes, - * after translating them from Pango attributes to ATK attributes. - * - * This is a convenience function that can be used to implement - * support for the #AtkText interface in widgets using Pango - * layouts. - * - * Returns: the modified @attributes - */ -AtkAttributeSet* -_gtk_pango_get_default_attributes (AtkAttributeSet *attributes, - PangoLayout *layout) -{ - PangoContext *context; - int i; - PangoWrapMode mode; - - context = pango_layout_get_context (layout); - if (context) - { - PangoLanguage *language; - PangoFontDescription *font; - - language = pango_context_get_language (context); - if (language) - attributes = add_attribute (attributes, ATK_TEXT_ATTR_LANGUAGE, - pango_language_to_string (language)); - - font = pango_context_get_font_description (context); - if (font) - { - char buf[60]; - attributes = add_attribute (attributes, ATK_TEXT_ATTR_STYLE, - atk_text_attribute_get_value (ATK_TEXT_ATTR_STYLE, - pango_font_description_get_style (font))); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_VARIANT, - atk_text_attribute_get_value (ATK_TEXT_ATTR_VARIANT, - pango_font_description_get_variant (font))); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_STRETCH, - atk_text_attribute_get_value (ATK_TEXT_ATTR_STRETCH, - pango_font_description_get_stretch (font))); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_FAMILY_NAME, - pango_font_description_get_family (font)); - g_snprintf (buf, 60, "%d", pango_font_description_get_weight (font)); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_WEIGHT, buf); - g_snprintf (buf, 60, "%i", pango_font_description_get_size (font) / PANGO_SCALE); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_SIZE, buf); - } - } - if (pango_layout_get_justify (layout)) - { - i = 3; - } - else - { - PangoAlignment align; - - align = pango_layout_get_alignment (layout); - if (align == PANGO_ALIGN_LEFT) - i = 0; - else if (align == PANGO_ALIGN_CENTER) - i = 2; - else /* PANGO_ALIGN_RIGHT */ - i = 1; - } - attributes = add_attribute (attributes, ATK_TEXT_ATTR_JUSTIFICATION, - atk_text_attribute_get_value (ATK_TEXT_ATTR_JUSTIFICATION, i)); - mode = pango_layout_get_wrap (layout); - if (mode == PANGO_WRAP_WORD) - i = 2; - else /* PANGO_WRAP_CHAR */ - i = 1; - attributes = add_attribute (attributes, ATK_TEXT_ATTR_WRAP_MODE, - atk_text_attribute_get_value (ATK_TEXT_ATTR_WRAP_MODE, i)); - - attributes = add_attribute (attributes, ATK_TEXT_ATTR_STRIKETHROUGH, - atk_text_attribute_get_value (ATK_TEXT_ATTR_STRIKETHROUGH, 0)); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_UNDERLINE, - atk_text_attribute_get_value (ATK_TEXT_ATTR_UNDERLINE, 0)); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_RISE, "0"); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_SCALE, "1"); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_BG_FULL_HEIGHT, "0"); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP, "0"); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_PIXELS_BELOW_LINES, "0"); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_PIXELS_ABOVE_LINES, "0"); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_EDITABLE, - atk_text_attribute_get_value (ATK_TEXT_ATTR_EDITABLE, 0)); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_INVISIBLE, - atk_text_attribute_get_value (ATK_TEXT_ATTR_INVISIBLE, 0)); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_INDENT, "0"); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_RIGHT_MARGIN, "0"); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_LEFT_MARGIN, "0"); - - return attributes; -} - -/* - * _gtk_pango_get_run_attributes: - * @attributes: a #AtkAttributeSet to add attributes to - * @layout: the #PangoLayout to get the attributes from - * @offset: the offset at which the attributes are wanted - * @start_offset: return location for the starting offset - * of the current run - * @end_offset: return location for the ending offset of the - * current run - * - * Finds the “run” around index (i.e. the maximal range of characters - * where the set of applicable attributes remains constant) and - * returns the starting and ending offsets for it. - * - * The attributes for the run are added to @attributes, after - * translating them from Pango attributes to ATK attributes. - * - * This is a convenience function that can be used to implement - * support for the #AtkText interface in widgets using Pango - * layouts. - * - * Returns: the modified #AtkAttributeSet - */ -AtkAttributeSet * -_gtk_pango_get_run_attributes (AtkAttributeSet *attributes, - PangoLayout *layout, - int offset, - int *start_offset, - int *end_offset) -{ - PangoAttrIterator *iter; - PangoAttrList *attr; - PangoAttrString *pango_string; - PangoAttrInt *pango_int; - PangoAttrColor *pango_color; - PangoAttrLanguage *pango_lang; - PangoAttrFloat *pango_float; - int index, start_index, end_index; - gboolean is_next; - glong len; - const char *text; - char *value; - - text = pango_layout_get_text (layout); - len = g_utf8_strlen (text, -1); - - /* Grab the attributes of the PangoLayout, if any */ - attr = pango_layout_get_attributes (layout); - - if (attr == NULL) - { - *start_offset = 0; - *end_offset = len; - return attributes; - } - - iter = pango_attr_list_get_iterator (attr); - /* Get invariant range offsets */ - /* If offset out of range, set offset in range */ - if (offset > len) - offset = len; - else if (offset < 0) - offset = 0; - - index = g_utf8_offset_to_pointer (text, offset) - text; - pango_attr_iterator_range (iter, &start_index, &end_index); - is_next = TRUE; - while (is_next) - { - if (index >= start_index && index < end_index) - { - *start_offset = g_utf8_pointer_to_offset (text, text + start_index); - if (end_index == G_MAXINT) /* Last iterator */ - end_index = len; - - *end_offset = g_utf8_pointer_to_offset (text, text + end_index); - break; - } - is_next = pango_attr_iterator_next (iter); - pango_attr_iterator_range (iter, &start_index, &end_index); - } - - /* Get attributes */ - pango_string = (PangoAttrString*) pango_attr_iterator_get (iter, PANGO_ATTR_FAMILY); - if (pango_string != NULL) - { - value = g_strdup_printf ("%s", pango_string->value); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_FAMILY_NAME, value); - g_free (value); - } - pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter, PANGO_ATTR_STYLE); - if (pango_int != NULL) - { - attributes = add_attribute (attributes, ATK_TEXT_ATTR_STYLE, - atk_text_attribute_get_value (ATK_TEXT_ATTR_STYLE, pango_int->value)); - } - pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter, PANGO_ATTR_WEIGHT); - if (pango_int != NULL) - { - value = g_strdup_printf ("%i", pango_int->value); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_WEIGHT, value); - g_free (value); - } - pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter, PANGO_ATTR_VARIANT); - if (pango_int != NULL) - { - attributes = add_attribute (attributes, ATK_TEXT_ATTR_VARIANT, - atk_text_attribute_get_value (ATK_TEXT_ATTR_VARIANT, pango_int->value)); - } - pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter, PANGO_ATTR_STRETCH); - if (pango_int != NULL) - { - attributes = add_attribute (attributes, ATK_TEXT_ATTR_STRETCH, - atk_text_attribute_get_value (ATK_TEXT_ATTR_STRETCH, pango_int->value)); - } - pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter, PANGO_ATTR_SIZE); - if (pango_int != NULL) - { - value = g_strdup_printf ("%i", pango_int->value / PANGO_SCALE); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_SIZE, value); - g_free (value); - } - pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter, PANGO_ATTR_UNDERLINE); - if (pango_int != NULL) - { - attributes = add_attribute (attributes, ATK_TEXT_ATTR_UNDERLINE, - atk_text_attribute_get_value (ATK_TEXT_ATTR_UNDERLINE, pango_int->value)); - } - pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter, PANGO_ATTR_STRIKETHROUGH); - if (pango_int != NULL) - { - attributes = add_attribute (attributes, ATK_TEXT_ATTR_STRIKETHROUGH, - atk_text_attribute_get_value (ATK_TEXT_ATTR_STRIKETHROUGH, pango_int->value)); - } - pango_int = (PangoAttrInt*) pango_attr_iterator_get (iter, PANGO_ATTR_RISE); - if (pango_int != NULL) - { - value = g_strdup_printf ("%i", pango_int->value); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_RISE, value); - g_free (value); - } - pango_lang = (PangoAttrLanguage*) pango_attr_iterator_get (iter, PANGO_ATTR_LANGUAGE); - if (pango_lang != NULL) - { - attributes = add_attribute (attributes, ATK_TEXT_ATTR_LANGUAGE, - pango_language_to_string (pango_lang->value)); - } - pango_float = (PangoAttrFloat*) pango_attr_iterator_get (iter, PANGO_ATTR_SCALE); - if (pango_float != NULL) - { - value = g_strdup_printf ("%g", pango_float->value); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_SCALE, value); - g_free (value); - } - pango_color = (PangoAttrColor*) pango_attr_iterator_get (iter, PANGO_ATTR_FOREGROUND); - if (pango_color != NULL) - { - value = g_strdup_printf ("%u,%u,%u", - pango_color->color.red, - pango_color->color.green, - pango_color->color.blue); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_FG_COLOR, value); - g_free (value); - } - pango_color = (PangoAttrColor*) pango_attr_iterator_get (iter, PANGO_ATTR_BACKGROUND); - if (pango_color != NULL) - { - value = g_strdup_printf ("%u,%u,%u", - pango_color->color.red, - pango_color->color.green, - pango_color->color.blue); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_BG_COLOR, value); - g_free (value); - } - pango_attr_iterator_destroy (iter); - - return attributes; -} - -/* - * _gtk_pango_move_chars: - * @layout: a #PangoLayout - * @offset: a character offset in @layout - * @count: the number of characters to move from @offset - * - * Returns the position that is @count characters from the - * given @offset. @count may be positive or negative. - * - * For the purpose of this function, characters are defined - * by what Pango considers cursor positions. - * - * Returns: the new position - */ -static int -_gtk_pango_move_chars (PangoLayout *layout, - int offset, - int count) -{ - const PangoLogAttr *attrs; - int n_attrs; - - attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); - - while (count > 0 && offset < n_attrs - 1) - { - do - offset++; - while (offset < n_attrs - 1 && !attrs[offset].is_cursor_position); - - count--; - } - while (count < 0 && offset > 0) - { - do - offset--; - while (offset > 0 && !attrs[offset].is_cursor_position); - - count++; - } - - return offset; -} - -/* - * _gtk_pango_move_words: - * @layout: a #PangoLayout - * @offset: a character offset in @layout - * @count: the number of words to move from @offset - * - * Returns the position that is @count words from the - * given @offset. @count may be positive or negative. - * - * If @count is positive, the returned position will - * be a word end, otherwise it will be a word start. - * See the Pango documentation for details on how - * word starts and ends are defined. - * - * Returns: the new position - */ -static int -_gtk_pango_move_words (PangoLayout *layout, - int offset, - int count) -{ - const PangoLogAttr *attrs; - int n_attrs; - - attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); - - while (count > 0 && offset < n_attrs - 1) - { - do - offset++; - while (offset < n_attrs - 1 && !attrs[offset].is_word_end); - - count--; - } - while (count < 0 && offset > 0) - { - do - offset--; - while (offset > 0 && !attrs[offset].is_word_start); - - count++; - } - - return offset; -} - -/* - * _gtk_pango_move_sentences: - * @layout: a #PangoLayout - * @offset: a character offset in @layout - * @count: the number of sentences to move from @offset - * - * Returns the position that is @count sentences from the - * given @offset. @count may be positive or negative. - * - * If @count is positive, the returned position will - * be a sentence end, otherwise it will be a sentence start. - * See the Pango documentation for details on how - * sentence starts and ends are defined. - * - * Returns: the new position - */ -static int -_gtk_pango_move_sentences (PangoLayout *layout, - int offset, - int count) -{ - const PangoLogAttr *attrs; - int n_attrs; - - attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); - - while (count > 0 && offset < n_attrs - 1) - { - do - offset++; - while (offset < n_attrs - 1 && !attrs[offset].is_sentence_end); - - count--; - } - while (count < 0 && offset > 0) - { - do - offset--; - while (offset > 0 && !attrs[offset].is_sentence_start); - - count++; - } - - return offset; -} - -/* - * _gtk_pango_is_inside_word: - * @layout: a #PangoLayout - * @offset: a character offset in @layout - * - * Returns whether the given position is inside - * a word. - * - * Returns: %TRUE if @offset is inside a word - */ -static gboolean -_gtk_pango_is_inside_word (PangoLayout *layout, - int offset) -{ - const PangoLogAttr *attrs; - int n_attrs; - - attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); - - while (offset >= 0 && - !(attrs[offset].is_word_start || attrs[offset].is_word_end)) - offset--; - - if (offset >= 0) - return attrs[offset].is_word_start; - - return FALSE; -} - -/* - * _gtk_pango_is_inside_sentence: - * @layout: a #PangoLayout - * @offset: a character offset in @layout - * - * Returns whether the given position is inside - * a sentence. - * - * Returns: %TRUE if @offset is inside a sentence - */ -static gboolean -_gtk_pango_is_inside_sentence (PangoLayout *layout, - int offset) -{ - const PangoLogAttr *attrs; - int n_attrs; - - attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); - - while (offset >= 0 && - !(attrs[offset].is_sentence_start || attrs[offset].is_sentence_end)) - offset--; - - if (offset >= 0) - return attrs[offset].is_sentence_start; - - return FALSE; -} - -static void -pango_layout_get_line_before (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset) -{ - PangoLayoutIter *iter; - PangoLayoutLine *line, *prev_line = NULL, *prev_prev_line = NULL; - int index, start_index, end_index; - const char *text; - gboolean found = FALSE; - - text = pango_layout_get_text (layout); - index = g_utf8_offset_to_pointer (text, offset) - text; - iter = pango_layout_get_iter (layout); - do - { - line = pango_layout_iter_get_line (iter); - start_index = line->start_index; - end_index = start_index + line->length; - - if (index >= start_index && index <= end_index) - { - /* Found line for offset */ - if (prev_line) - { - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_LINE_START: - end_index = start_index; - start_index = prev_line->start_index; - break; - case ATK_TEXT_BOUNDARY_LINE_END: - if (prev_prev_line) - start_index = prev_prev_line->start_index + prev_prev_line->length; - else - start_index = 0; - end_index = prev_line->start_index + prev_line->length; - break; - case ATK_TEXT_BOUNDARY_CHAR: - case ATK_TEXT_BOUNDARY_WORD_START: - case ATK_TEXT_BOUNDARY_WORD_END: - case ATK_TEXT_BOUNDARY_SENTENCE_START: - case ATK_TEXT_BOUNDARY_SENTENCE_END: - default: - g_assert_not_reached(); - break; - } - } - else - start_index = end_index = 0; - - found = TRUE; - break; - } - - prev_prev_line = prev_line; - prev_line = line; - } - while (pango_layout_iter_next_line (iter)); - - if (!found) - { - start_index = prev_line->start_index + prev_line->length; - end_index = start_index; - } - pango_layout_iter_free (iter); - - *start_offset = g_utf8_pointer_to_offset (text, text + start_index); - *end_offset = g_utf8_pointer_to_offset (text, text + end_index); -} - -static void -pango_layout_get_line_at (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset) -{ - PangoLayoutIter *iter; - PangoLayoutLine *line, *prev_line = NULL; - int index, start_index, end_index; - const char *text; - gboolean found = FALSE; - - text = pango_layout_get_text (layout); - index = g_utf8_offset_to_pointer (text, offset) - text; - iter = pango_layout_get_iter (layout); - do - { - line = pango_layout_iter_get_line (iter); - start_index = line->start_index; - end_index = start_index + line->length; - - if (index >= start_index && index <= end_index) - { - /* Found line for offset */ - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_LINE_START: - if (pango_layout_iter_next_line (iter)) - end_index = pango_layout_iter_get_line (iter)->start_index; - break; - case ATK_TEXT_BOUNDARY_LINE_END: - if (prev_line) - start_index = prev_line->start_index + prev_line->length; - break; - case ATK_TEXT_BOUNDARY_CHAR: - case ATK_TEXT_BOUNDARY_WORD_START: - case ATK_TEXT_BOUNDARY_WORD_END: - case ATK_TEXT_BOUNDARY_SENTENCE_START: - case ATK_TEXT_BOUNDARY_SENTENCE_END: - default: - g_assert_not_reached(); - break; - } - - found = TRUE; - break; - } - - prev_line = line; - } - while (pango_layout_iter_next_line (iter)); - - if (!found) - { - start_index = prev_line->start_index + prev_line->length; - end_index = start_index; - } - pango_layout_iter_free (iter); - - *start_offset = g_utf8_pointer_to_offset (text, text + start_index); - *end_offset = g_utf8_pointer_to_offset (text, text + end_index); -} - -static void -pango_layout_get_line_after (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset) -{ - PangoLayoutIter *iter; - PangoLayoutLine *line, *prev_line = NULL; - int index, start_index, end_index; - const char *text; - gboolean found = FALSE; - - text = pango_layout_get_text (layout); - index = g_utf8_offset_to_pointer (text, offset) - text; - iter = pango_layout_get_iter (layout); - do - { - line = pango_layout_iter_get_line (iter); - start_index = line->start_index; - end_index = start_index + line->length; - - if (index >= start_index && index <= end_index) - { - /* Found line for offset */ - if (pango_layout_iter_next_line (iter)) - { - line = pango_layout_iter_get_line (iter); - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_LINE_START: - start_index = line->start_index; - if (pango_layout_iter_next_line (iter)) - end_index = pango_layout_iter_get_line (iter)->start_index; - else - end_index = start_index + line->length; - break; - case ATK_TEXT_BOUNDARY_LINE_END: - start_index = end_index; - end_index = line->start_index + line->length; - break; - case ATK_TEXT_BOUNDARY_CHAR: - case ATK_TEXT_BOUNDARY_WORD_START: - case ATK_TEXT_BOUNDARY_WORD_END: - case ATK_TEXT_BOUNDARY_SENTENCE_START: - case ATK_TEXT_BOUNDARY_SENTENCE_END: - default: - g_assert_not_reached(); - break; - } - } - else - start_index = end_index; - - found = TRUE; - break; - } - - prev_line = line; - } - while (pango_layout_iter_next_line (iter)); - - if (!found) - { - start_index = prev_line->start_index + prev_line->length; - end_index = start_index; - } - pango_layout_iter_free (iter); - - *start_offset = g_utf8_pointer_to_offset (text, text + start_index); - *end_offset = g_utf8_pointer_to_offset (text, text + end_index); -} - -/* - * _gtk_pango_get_text_before: - * @layout: a #PangoLayout - * @boundary_type: a #AtkTextBoundary - * @offset: a character offset in @layout - * @start_offset: return location for the start of the returned text - * @end_offset: return location for the end of the return text - * - * Gets a slice of the text from @layout before @offset. - * - * The @boundary_type determines the size of the returned slice of - * text. For the exact semantics of this function, see - * atk_text_get_text_before_offset(). - * - * Returns: a newly allocated string containing a slice of text - * from layout. Free with g_free(). - */ -char * -_gtk_pango_get_text_before (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset) -{ - const char *text; - int start, end; - const PangoLogAttr *attrs; - int n_attrs; - - text = pango_layout_get_text (layout); - - if (text[0] == 0) - { - *start_offset = 0; - *end_offset = 0; - return g_strdup (""); - } - - attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); - - start = offset; - end = start; - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - start = _gtk_pango_move_chars (layout, start, -1); - break; - - case ATK_TEXT_BOUNDARY_WORD_START: - if (!attrs[start].is_word_start) - start = _gtk_pango_move_words (layout, start, -1); - end = start; - start = _gtk_pango_move_words (layout, start, -1); - break; - - case ATK_TEXT_BOUNDARY_WORD_END: - if (_gtk_pango_is_inside_word (layout, start) && - !attrs[start].is_word_start) - start = _gtk_pango_move_words (layout, start, -1); - while (!attrs[start].is_word_end && start > 0) - start = _gtk_pango_move_chars (layout, start, -1); - end = start; - start = _gtk_pango_move_words (layout, start, -1); - while (!attrs[start].is_word_end && start > 0) - start = _gtk_pango_move_chars (layout, start, -1); - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_START: - if (!attrs[start].is_sentence_start) - start = _gtk_pango_move_sentences (layout, start, -1); - end = start; - start = _gtk_pango_move_sentences (layout, start, -1); - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_END: - if (_gtk_pango_is_inside_sentence (layout, start) && - !attrs[start].is_sentence_start) - start = _gtk_pango_move_sentences (layout, start, -1); - while (!attrs[start].is_sentence_end && start > 0) - start = _gtk_pango_move_chars (layout, start, -1); - end = start; - start = _gtk_pango_move_sentences (layout, start, -1); - while (!attrs[start].is_sentence_end && start > 0) - start = _gtk_pango_move_chars (layout, start, -1); - break; - - case ATK_TEXT_BOUNDARY_LINE_START: - case ATK_TEXT_BOUNDARY_LINE_END: - pango_layout_get_line_before (layout, boundary_type, offset, &start, &end); - break; - - default: - g_assert_not_reached (); - break; - } - - *start_offset = start; - *end_offset = end; - - g_assert (start <= end); - - return g_utf8_substring (text, start, end); -} - -/* - * _gtk_pango_get_text_after: - * @layout: a #PangoLayout - * @boundary_type: a #AtkTextBoundary - * @offset: a character offset in @layout - * @start_offset: return location for the start of the returned text - * @end_offset: return location for the end of the return text - * - * Gets a slice of the text from @layout after @offset. - * - * The @boundary_type determines the size of the returned slice of - * text. For the exact semantics of this function, see - * atk_text_get_text_after_offset(). - * - * Returns: a newly allocated string containing a slice of text - * from layout. Free with g_free(). - */ -char * -_gtk_pango_get_text_after (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset) -{ - const char *text; - int start, end; - const PangoLogAttr *attrs; - int n_attrs; - - text = pango_layout_get_text (layout); - - if (text[0] == 0) - { - *start_offset = 0; - *end_offset = 0; - return g_strdup (""); - } - - attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); - - start = offset; - end = start; - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - start = _gtk_pango_move_chars (layout, start, 1); - end = start; - end = _gtk_pango_move_chars (layout, end, 1); - break; - - case ATK_TEXT_BOUNDARY_WORD_START: - if (_gtk_pango_is_inside_word (layout, end)) - end = _gtk_pango_move_words (layout, end, 1); - while (!attrs[end].is_word_start && end < n_attrs - 1) - end = _gtk_pango_move_chars (layout, end, 1); - start = end; - if (end < n_attrs - 1) - { - end = _gtk_pango_move_words (layout, end, 1); - while (!attrs[end].is_word_start && end < n_attrs - 1) - end = _gtk_pango_move_chars (layout, end, 1); - } - break; - - case ATK_TEXT_BOUNDARY_WORD_END: - end = _gtk_pango_move_words (layout, end, 1); - start = end; - if (end < n_attrs - 1) - end = _gtk_pango_move_words (layout, end, 1); - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_START: - if (_gtk_pango_is_inside_sentence (layout, end)) - end = _gtk_pango_move_sentences (layout, end, 1); - while (!attrs[end].is_sentence_start && end < n_attrs - 1) - end = _gtk_pango_move_chars (layout, end, 1); - start = end; - if (end < n_attrs - 1) - { - end = _gtk_pango_move_sentences (layout, end, 1); - while (!attrs[end].is_sentence_start && end < n_attrs - 1) - end = _gtk_pango_move_chars (layout, end, 1); - } - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_END: - end = _gtk_pango_move_sentences (layout, end, 1); - start = end; - if (end < n_attrs - 1) - end = _gtk_pango_move_sentences (layout, end, 1); - break; - - case ATK_TEXT_BOUNDARY_LINE_START: - case ATK_TEXT_BOUNDARY_LINE_END: - pango_layout_get_line_after (layout, boundary_type, offset, &start, &end); - break; - - default: - g_assert_not_reached (); - break; - } - - *start_offset = start; - *end_offset = end; - - g_assert (start <= end); - - return g_utf8_substring (text, start, end); -} - -/* - * _gtk_pango_get_text_at: - * @layout: a #PangoLayout - * @boundary_type: a #AtkTextBoundary - * @offset: a character offset in @layout - * @start_offset: return location for the start of the returned text - * @end_offset: return location for the end of the return text - * - * Gets a slice of the text from @layout at @offset. - * - * The @boundary_type determines the size of the returned slice of - * text. For the exact semantics of this function, see - * atk_text_get_text_after_offset(). - * - * Returns: a newly allocated string containing a slice of text - * from layout. Free with g_free(). - */ -char * -_gtk_pango_get_text_at (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset) -{ - const char *text; - int start, end; - const PangoLogAttr *attrs; - int n_attrs; - - text = pango_layout_get_text (layout); - - if (text[0] == 0) - { - *start_offset = 0; - *end_offset = 0; - return g_strdup (""); - } - - attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); - - start = offset; - end = start; - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - end = _gtk_pango_move_chars (layout, end, 1); - break; - - case ATK_TEXT_BOUNDARY_WORD_START: - if (!attrs[start].is_word_start) - start = _gtk_pango_move_words (layout, start, -1); - if (_gtk_pango_is_inside_word (layout, end)) - end = _gtk_pango_move_words (layout, end, 1); - while (!attrs[end].is_word_start && end < n_attrs - 1) - end = _gtk_pango_move_chars (layout, end, 1); - break; - - case ATK_TEXT_BOUNDARY_WORD_END: - if (_gtk_pango_is_inside_word (layout, start) && - !attrs[start].is_word_start) - start = _gtk_pango_move_words (layout, start, -1); - while (!attrs[start].is_word_end && start > 0) - start = _gtk_pango_move_chars (layout, start, -1); - end = _gtk_pango_move_words (layout, end, 1); - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_START: - if (!attrs[start].is_sentence_start) - start = _gtk_pango_move_sentences (layout, start, -1); - if (_gtk_pango_is_inside_sentence (layout, end)) - end = _gtk_pango_move_sentences (layout, end, 1); - while (!attrs[end].is_sentence_start && end < n_attrs - 1) - end = _gtk_pango_move_chars (layout, end, 1); - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_END: - if (_gtk_pango_is_inside_sentence (layout, start) && - !attrs[start].is_sentence_start) - start = _gtk_pango_move_sentences (layout, start, -1); - while (!attrs[start].is_sentence_end && start > 0) - start = _gtk_pango_move_chars (layout, start, -1); - end = _gtk_pango_move_sentences (layout, end, 1); - break; - - case ATK_TEXT_BOUNDARY_LINE_START: - case ATK_TEXT_BOUNDARY_LINE_END: - pango_layout_get_line_at (layout, boundary_type, offset, &start, &end); - break; - - default: - g_assert_not_reached (); - break; - } - - *start_offset = start; - *end_offset = end; - - g_assert (start <= end); - - return g_utf8_substring (text, start, end); -} - static gboolean attr_list_merge_filter (PangoAttribute *attribute, gpointer list) diff --git a/gtk/gtkpango.h b/gtk/gtkpango.h index 1f60925a98..a7eae932c3 100644 --- a/gtk/gtkpango.h +++ b/gtk/gtkpango.h @@ -25,38 +25,11 @@ #ifndef __GTK_PANGO_H__ #define __GTK_PANGO_H__ - #include <pango/pangocairo.h> -#include <atk/atk.h> #include "gtkbuildable.h" G_BEGIN_DECLS -AtkAttributeSet *_gtk_pango_get_default_attributes (AtkAttributeSet *attributes, - PangoLayout *layout); - -AtkAttributeSet *_gtk_pango_get_run_attributes (AtkAttributeSet *attributes, - PangoLayout *layout, - int offset, - int *start_offset, - int *end_offset); - -char *_gtk_pango_get_text_before (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset); -char *_gtk_pango_get_text_at (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset); -char *_gtk_pango_get_text_after (PangoLayout *layout, - AtkTextBoundary boundary_type, - int offset, - int *start_offset, - int *end_offset); - PangoAttrList *_gtk_pango_attr_list_merge (PangoAttrList *into, PangoAttrList *from); diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c index 30e0950490..93d560e49e 100644 --- a/gtk/gtkpasswordentry.c +++ b/gtk/gtkpasswordentry.c @@ -22,7 +22,6 @@ #include "gtkpasswordentryprivate.h" -#include "gtkaccessible.h" #include "gtktextprivate.h" #include "gtkeditable.h" #include "gtkgestureclick.h" @@ -35,8 +34,6 @@ #include "gtkstylecontext.h" #include "gtkeventcontrollerkey.h" -#include "a11y/gtkpasswordentryaccessibleprivate.h" - /** * SECTION:gtkpasswordentry * @Short_description: An entry for secrets @@ -130,11 +127,6 @@ gtk_password_entry_toggle_peek (GtkPasswordEntry *entry) visibility = gtk_text_get_visibility (GTK_TEXT (priv->entry)); gtk_text_set_visibility (GTK_TEXT (priv->entry), !visibility); - - /* Update the accessible object to reflect the change of visibility */ - GtkAccessible *accessible = GTK_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (entry))); - if (accessible != NULL) - gtk_password_entry_accessible_update_visibility (GTK_PASSWORD_ENTRY_ACCESSIBLE (accessible)); } static void @@ -431,7 +423,6 @@ gtk_password_entry_class_init (GtkPasswordEntryClass *klass) g_object_class_install_properties (object_class, NUM_PROPERTIES, props); gtk_editable_install_properties (object_class, NUM_PROPERTIES); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_PASSWORD_ENTRY_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("entry")); } diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index e3e0b284b4..bf9ec5e67f 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -1037,7 +1037,6 @@ make_directory_button (GtkPathBar *path_bar, gboolean current_dir, gboolean file_is_hidden) { - AtkObject *atk_obj; GtkWidget *child = NULL; ButtonData *button_data; GdkContentProvider *content; @@ -1048,7 +1047,6 @@ make_directory_button (GtkPathBar *path_bar, button_data = g_new0 (ButtonData, 1); button_data->type = find_button_type (path_bar, file); button_data->button = gtk_toggle_button_new (); - atk_obj = gtk_widget_get_accessible (button_data->button); gtk_widget_set_focus_on_click (button_data->button, FALSE); switch (button_data->type) @@ -1057,7 +1055,6 @@ make_directory_button (GtkPathBar *path_bar, button_data->image = gtk_image_new (); child = button_data->image; button_data->label = NULL; - atk_object_set_name (atk_obj, _("File System Root")); break; case HOME_BUTTON: case DESKTOP_BUTTON: diff --git a/gtk/gtkpicture.c b/gtk/gtkpicture.c index a60f7c626d..4ac9675175 100644 --- a/gtk/gtkpicture.c +++ b/gtk/gtkpicture.c @@ -30,8 +30,6 @@ #include "gtksnapshot.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkpictureaccessibleprivate.h" - /** * SECTION:gtkpicture * @Short_description: A widget displaying a #GdkPaintable @@ -366,7 +364,6 @@ gtk_picture_class_init (GtkPictureClass *class) g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_PICTURE_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("picture")); } diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c index 3a1fecf23c..5be9cf1430 100644 --- a/gtk/gtkprogressbar.c +++ b/gtk/gtkprogressbar.c @@ -39,8 +39,6 @@ #include "gtkstylecontextprivate.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkprogressbaraccessibleprivate.h" - #include <string.h> /** @@ -250,7 +248,6 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class) g_object_class_install_properties (gobject_class, NUM_PROPERTIES, progress_props); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_PROGRESS_BAR_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("progressbar")); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); } @@ -732,14 +729,6 @@ gtk_progress_bar_set_fraction (GtkProgressBar *pbar, gtk_widget_queue_allocate (pbar->trough_widget); update_fraction_classes (pbar); - { - AtkObject *accessible = - _gtk_widget_peek_accessible (GTK_WIDGET (pbar)); - - if (accessible != NULL) - gtk_progress_bar_accessible_update_value (GTK_PROGRESS_BAR_ACCESSIBLE (accessible)); - } - g_object_notify_by_pspec (G_OBJECT (pbar), progress_props[PROP_FRACTION]); } diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index 5a7e4a825b..79abccdb66 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -32,7 +32,6 @@ #include "gtkmarshalers.h" #include "gtkprivate.h" #include "gtkintl.h" -#include "a11y/gtkradiobuttonaccessible.h" #include "gtkstylecontextprivate.h" /** @@ -229,7 +228,6 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class) NULL, G_TYPE_NONE, 0); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_RADIO_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("radiobutton")); } diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 454240cfff..dc2a90b2bf 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -43,8 +43,6 @@ #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkrangeaccessible.h" - #include <stdio.h> #include <math.h> @@ -429,7 +427,6 @@ gtk_range_class_init (GtkRangeClass *class) g_object_class_install_properties (gobject_class, LAST_PROP, properties); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_RANGE_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("range")); } @@ -663,14 +660,6 @@ gtk_range_set_adjustment (GtkRange *range, gtk_range_adjustment_changed (adjustment, range); gtk_range_adjustment_value_changed (adjustment, range); - { - GtkRangeAccessible *accessible = - GTK_RANGE_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (range))); - - if (accessible != NULL) - gtk_range_accessible_update_adjustment (accessible); - } - g_object_notify_by_pspec (G_OBJECT (range), properties[PROP_ADJUSTMENT]); } } diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 3c8056e635..5acc0fc8dc 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -43,8 +43,6 @@ #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkscaleaccessible.h" - #include <math.h> #include <stdlib.h> @@ -817,7 +815,6 @@ gtk_scale_class_init (GtkScaleClass *class) add_slider_binding (binding_set, GDK_KEY_KP_End, 0, GTK_SCROLL_END); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCALE_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("scale")); } diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c index 11ddc585e2..ecdf50644a 100644 --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -56,8 +56,6 @@ #include "gtkwindowprivate.h" #include "gtknative.h" -#include "a11y/gtkscalebuttonaccessible.h" - #include <math.h> #include <stdlib.h> #include <string.h> @@ -343,7 +341,6 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass) gtk_widget_class_bind_template_callback (widget_class, cb_scale_value_changed); gtk_widget_class_bind_template_callback (widget_class, cb_popup_mapped); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCALE_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("scalebutton")); } diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c index 7e9bdaae80..da489dc4f1 100644 --- a/gtk/gtkscrollbar.c +++ b/gtk/gtkscrollbar.c @@ -35,8 +35,6 @@ #include "gtkwidgetprivate.h" #include "gtkboxlayout.h" -#include "a11y/gtkscrollbaraccessible.h" - /** * SECTION:gtkscrollbar @@ -205,7 +203,6 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class) g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation"); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCROLLBAR_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("scrollbar")); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); } diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 91d6c2e91c..e9c62dbcf8 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -53,8 +53,6 @@ #include "gtkviewport.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkscrolledwindowaccessible.h" - #include <math.h> /** @@ -872,7 +870,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) add_tab_bindings (widget_class, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD); add_tab_bindings (widget_class, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCROLLED_WINDOW_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("scrolledwindow")); } diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c index 4be02d57a7..ab94d0718c 100644 --- a/gtk/gtksearchentry.c +++ b/gtk/gtksearchentry.c @@ -29,7 +29,6 @@ #include "gtksearchentryprivate.h" -#include "gtkaccessible.h" #include "gtkeditable.h" #include "gtkboxlayout.h" #include "gtkgestureclick.h" @@ -41,7 +40,6 @@ #include "gtkstylecontext.h" #include "gtkeventcontrollerkey.h" #include "gtkwidgetprivate.h" -#include "a11y/gtksearchentryaccessible.h" /** @@ -398,7 +396,6 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass) "stop-search", NULL); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SEARCH_ENTRY_ACCESSIBLE); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("entry")); } diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c index 4c2f23adb0..6a515dbf89 100644 --- a/gtk/gtkseparator.c +++ b/gtk/gtkseparator.c @@ -136,7 +136,6 @@ gtk_separator_class_init (GtkSeparatorClass *class) g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation"); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_SEPARATOR); gtk_widget_class_set_css_name (widget_class, I_("separator")); } diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 7e7460490f..00dae1a003 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -55,8 +55,6 @@ #include "gtkboxlayout.h" #include "gtktextprivate.h" -#include "a11y/gtkspinbuttonaccessible.h" - #include <stdio.h> #include <stdlib.h> #include <math.h> @@ -549,7 +547,6 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) add_spin_binding (widget_class, GDK_KEY_Page_Up, GDK_CONTROL_MASK, GTK_SCROLL_END); add_spin_binding (widget_class, GDK_KEY_Page_Down, GDK_CONTROL_MASK, GTK_SCROLL_START); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SPIN_BUTTON_ACCESSIBLE); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("spinbutton")); } diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c index cb83e568f0..dfa87c4bd2 100644 --- a/gtk/gtkspinner.c +++ b/gtk/gtkspinner.c @@ -37,7 +37,6 @@ #include "gtkstylecontext.h" #include "gtkstylecontextprivate.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkspinneraccessible.h" #include "gtkcssnumbervalueprivate.h" #include "gtkrendericonprivate.h" @@ -242,7 +241,6 @@ gtk_spinner_class_init (GtkSpinnerClass *klass) FALSE, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SPINNER_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("spinner")); } diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index 98cdc4093a..51a39bfd1f 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -31,8 +31,6 @@ #include "gtkwidgetprivate.h" #include "gtksingleselection.h" #include "gtklistlistmodelprivate.h" -#include "a11y/gtkstackaccessible.h" -#include "a11y/gtkstackaccessibleprivate.h" #include <math.h> #include <string.h> @@ -750,8 +748,6 @@ gtk_stack_class_init (GtkStackClass *klass) g_object_class_install_properties (object_class, LAST_PROP, stack_props); - - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_STACK_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("stack")); } @@ -1172,10 +1168,6 @@ set_visible_child (GtkStack *stack, } } - gtk_stack_accessible_update_visible_child (stack, - priv->visible_child ? priv->visible_child->widget : NULL, - child_info ? child_info->widget : NULL); - priv->visible_child = child_info; if (child_info) diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c index 67e0c37f6d..76985afdf6 100644 --- a/gtk/gtkstackswitcher.c +++ b/gtk/gtkstackswitcher.c @@ -33,8 +33,6 @@ #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkcompositeaccessible.h" - /** * SECTION:gtkstackswitcher * @Short_description: A controller for GtkStack @@ -502,7 +500,6 @@ gtk_stack_switcher_class_init (GtkStackSwitcherClass *class) gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("stackswitcher")); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_COMPOSITE_ACCESSIBLE); } /** diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index b836c80942..3a656b9c87 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -36,7 +36,6 @@ #include "gtkorientable.h" #include "gtktypebuiltins.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkstatusbaraccessible.h" /** * SECTION:gtkstatusbar @@ -203,7 +202,6 @@ gtk_statusbar_class_init (GtkStatusbarClass *class) gtk_widget_class_bind_template_child_internal (widget_class, GtkStatusbar, message_area); gtk_widget_class_bind_template_child (widget_class, GtkStatusbar, label); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_STATUSBAR_ACCESSIBLE); gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("statusbar")); } diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index f32e0d7c6e..36fa633f5a 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -1321,58 +1321,6 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot, } } -static AtkAttributeSet * -add_attribute (AtkAttributeSet *attributes, - AtkTextAttribute attr, - const char *value) -{ - AtkAttribute *at; - - at = g_new (AtkAttribute, 1); - at->name = g_strdup (atk_text_attribute_get_name (attr)); - at->value = g_strdup (value); - - return g_slist_prepend (attributes, at); -} - -/* - * _gtk_style_context_get_attributes: - * @attributes: a #AtkAttributeSet to add attributes to - * @context: the #GtkStyleContext to get attributes from - * @flags: the state to use with @context - * - * Adds the foreground and background color from @context to - * @attributes, after translating them to ATK attributes. - * - * This is a convenience function that can be used in - * implementing the #AtkText interface in widgets. - * - * Returns: the modified #AtkAttributeSet - */ -AtkAttributeSet * -_gtk_style_context_get_attributes (AtkAttributeSet *attributes, - GtkStyleContext *context) -{ - const GdkRGBA *color; - char *value; - - color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)); - value = g_strdup_printf ("%u,%u,%u", - (guint) ceil (color->red * 65536 - color->red), - (guint) ceil (color->green * 65536 - color->green), - (guint) ceil (color->blue * 65536 - color->blue)); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_BG_COLOR, value); - - color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)); - value = g_strdup_printf ("%u,%u,%u", - (guint) ceil (color->red * 65536 - color->red), - (guint) ceil (color->green * 65536 - color->green), - (guint) ceil (color->blue * 65536 - color->blue)); - attributes = add_attribute (attributes, ATK_TEXT_ATTR_FG_COLOR, value); - - return attributes; -} - /** * GtkStyleContextPrintFlags: * @GTK_STYLE_CONTEXT_PRINT_NONE: Default value. diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h index b902bb5b99..09fde7ce11 100644 --- a/gtk/gtkstylecontextprivate.h +++ b/gtk/gtkstylecontextprivate.h @@ -26,8 +26,6 @@ #include "gtkbitmaskprivate.h" #include "gtkcssvalueprivate.h" -#include <atk/atk.h> - G_BEGIN_DECLS GtkStyleContext *gtk_style_context_new_for_node (GtkCssNode *node); @@ -46,10 +44,6 @@ void _gtk_style_context_get_cursor_color (GtkStyleContext GdkRGBA *primary_color, GdkRGBA *secondary_color); -/* Accessibility support */ -AtkAttributeSet *_gtk_style_context_get_attributes (AtkAttributeSet *attributes, - GtkStyleContext *context); - G_END_DECLS #endif /* __GTK_STYLE_CONTEXT_PRIVATE_H__ */ diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c index 040519506e..64e9cc379b 100644 --- a/gtk/gtkswitch.c +++ b/gtk/gtkswitch.c @@ -69,8 +69,6 @@ #include "gtkstylecontextprivate.h" #include "gtkwidgetprivate.h" -#include "a11y/gtkswitchaccessible.h" - typedef struct _GtkSwitchClass GtkSwitchClass; /** @@ -607,9 +605,6 @@ gtk_switch_class_init (GtkSwitchClass *klass) g_object_class_override_property (gobject_class, PROP_ACTION_NAME, "action-name"); g_object_class_override_property (gobject_class, PROP_ACTION_TARGET, "action-target"); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SWITCH_ACCESSIBLE); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_TOGGLE_BUTTON); - gtk_widget_class_set_css_name (widget_class, I_("switch")); } @@ -692,7 +687,6 @@ gtk_switch_set_active (GtkSwitch *self, if (self->is_active != is_active) { - AtkObject *accessible; gboolean handled; self->is_active = is_active; @@ -706,9 +700,6 @@ gtk_switch_set_active (GtkSwitch *self, g_object_notify_by_pspec (G_OBJECT (self), switch_props[PROP_ACTIVE]); - accessible = gtk_widget_get_accessible (GTK_WIDGET (self)); - atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, self->is_active); - gtk_widget_queue_allocate (GTK_WIDGET (self)); } } diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 1dfd553022..2d2985978f 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -66,8 +66,6 @@ #include "gtknative.h" #include "gtkactionmuxerprivate.h" -#include "a11y/gtktextaccessible.h" - #include <cairo-gobject.h> #include <string.h> @@ -1480,8 +1478,6 @@ gtk_text_class_init (GtkTextClass *class) GDK_KEY_z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "text.redo", NULL); - - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TEXT_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("text")); } diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index 7626d29671..3e7e12c0fa 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -4376,316 +4376,6 @@ _gtk_text_buffer_spew (GtkTextBuffer *buffer) _gtk_text_btree_spew (get_btree (buffer)); } -void -_gtk_text_buffer_get_text_before (GtkTextBuffer *buffer, - AtkTextBoundary boundary_type, - GtkTextIter *position, - GtkTextIter *start, - GtkTextIter *end) -{ - int line_number; - - *start = *position; - *end = *start; - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - gtk_text_iter_backward_char (start); - break; - - case ATK_TEXT_BOUNDARY_WORD_START: - if (!gtk_text_iter_starts_word (start)) - gtk_text_iter_backward_word_start (start); - *end = *start; - gtk_text_iter_backward_word_start (start); - break; - - case ATK_TEXT_BOUNDARY_WORD_END: - if (gtk_text_iter_inside_word (start) && - !gtk_text_iter_starts_word (start)) - gtk_text_iter_backward_word_start (start); - while (!gtk_text_iter_ends_word (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - *end = *start; - gtk_text_iter_backward_word_start (start); - while (!gtk_text_iter_ends_word (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_START: - if (!gtk_text_iter_starts_sentence (start)) - gtk_text_iter_backward_sentence_start (start); - *end = *start; - gtk_text_iter_backward_sentence_start (start); - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_END: - if (gtk_text_iter_inside_sentence (start) && - !gtk_text_iter_starts_sentence (start)) - gtk_text_iter_backward_sentence_start (start); - while (!gtk_text_iter_ends_sentence (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - *end = *start; - gtk_text_iter_backward_sentence_start (start); - while (!gtk_text_iter_ends_sentence (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - break; - - case ATK_TEXT_BOUNDARY_LINE_START: - line_number = gtk_text_iter_get_line (start); - if (line_number == 0) - { - gtk_text_buffer_get_iter_at_offset (buffer, start, 0); - } - else - { - gtk_text_iter_backward_line (start); - gtk_text_iter_forward_line (start); - } - *end = *start; - gtk_text_iter_backward_line (start); - break; - - case ATK_TEXT_BOUNDARY_LINE_END: - line_number = gtk_text_iter_get_line (start); - if (line_number == 0) - { - gtk_text_buffer_get_iter_at_offset (buffer, start, 0); - *end = *start; - } - else - { - gtk_text_iter_backward_line (start); - *end = *start; - while (!gtk_text_iter_ends_line (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - gtk_text_iter_forward_to_line_end (end); - } - break; - - default: - g_assert_not_reached (); - break; - } -} - -void -_gtk_text_buffer_get_text_at (GtkTextBuffer *buffer, - AtkTextBoundary boundary_type, - GtkTextIter *position, - GtkTextIter *start, - GtkTextIter *end) -{ - int line_number; - - *start = *position; - *end = *start; - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - gtk_text_iter_forward_char (end); - break; - - case ATK_TEXT_BOUNDARY_WORD_START: - if (!gtk_text_iter_starts_word (start)) - gtk_text_iter_backward_word_start (start); - if (gtk_text_iter_inside_word (end)) - gtk_text_iter_forward_word_end (end); - while (!gtk_text_iter_starts_word (end)) - { - if (!gtk_text_iter_forward_char (end)) - break; - } - break; - - case ATK_TEXT_BOUNDARY_WORD_END: - if (gtk_text_iter_inside_word (start) && - !gtk_text_iter_starts_word (start)) - gtk_text_iter_backward_word_start (start); - while (!gtk_text_iter_ends_word (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - gtk_text_iter_forward_word_end (end); - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_START: - if (!gtk_text_iter_starts_sentence (start)) - gtk_text_iter_backward_sentence_start (start); - if (gtk_text_iter_inside_sentence (end)) - gtk_text_iter_forward_sentence_end (end); - while (!gtk_text_iter_starts_sentence (end)) - { - if (!gtk_text_iter_forward_char (end)) - break; - } - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_END: - if (gtk_text_iter_inside_sentence (start) && - !gtk_text_iter_starts_sentence (start)) - gtk_text_iter_backward_sentence_start (start); - while (!gtk_text_iter_ends_sentence (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - gtk_text_iter_forward_sentence_end (end); - break; - - case ATK_TEXT_BOUNDARY_LINE_START: - line_number = gtk_text_iter_get_line (start); - if (line_number == 0) - { - gtk_text_buffer_get_iter_at_offset (buffer, start, 0); - } - else - { - gtk_text_iter_backward_line (start); - gtk_text_iter_forward_line (start); - } - gtk_text_iter_forward_line (end); - break; - - case ATK_TEXT_BOUNDARY_LINE_END: - line_number = gtk_text_iter_get_line (start); - if (line_number == 0) - { - gtk_text_buffer_get_iter_at_offset (buffer, start, 0); - } - else - { - gtk_text_iter_backward_line (start); - gtk_text_iter_forward_line (start); - } - while (!gtk_text_iter_ends_line (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - gtk_text_iter_forward_to_line_end (end); - break; - - default: - g_assert_not_reached (); - break; - } -} - -void -_gtk_text_buffer_get_text_after (GtkTextBuffer *buffer, - AtkTextBoundary boundary_type, - GtkTextIter *position, - GtkTextIter *start, - GtkTextIter *end) -{ - *start = *position; - *end = *start; - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - gtk_text_iter_forward_char (start); - gtk_text_iter_forward_chars (end, 2); - break; - - case ATK_TEXT_BOUNDARY_WORD_START: - if (gtk_text_iter_inside_word (end)) - gtk_text_iter_forward_word_end (end); - while (!gtk_text_iter_starts_word (end)) - { - if (!gtk_text_iter_forward_char (end)) - break; - } - *start = *end; - if (!gtk_text_iter_is_end (end)) - { - gtk_text_iter_forward_word_end (end); - while (!gtk_text_iter_starts_word (end)) - { - if (!gtk_text_iter_forward_char (end)) - break; - } - } - break; - - case ATK_TEXT_BOUNDARY_WORD_END: - gtk_text_iter_forward_word_end (end); - *start = *end; - if (!gtk_text_iter_is_end (end)) - gtk_text_iter_forward_word_end (end); - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_START: - if (gtk_text_iter_inside_sentence (end)) - gtk_text_iter_forward_sentence_end (end); - while (!gtk_text_iter_starts_sentence (end)) - { - if (!gtk_text_iter_forward_char (end)) - break; - } - *start = *end; - if (!gtk_text_iter_is_end (end)) - { - gtk_text_iter_forward_sentence_end (end); - while (!gtk_text_iter_starts_sentence (end)) - { - if (!gtk_text_iter_forward_char (end)) - break; - } - } - break; - - case ATK_TEXT_BOUNDARY_SENTENCE_END: - gtk_text_iter_forward_sentence_end (end); - *start = *end; - if (!gtk_text_iter_is_end (end)) - gtk_text_iter_forward_sentence_end (end); - break; - - case ATK_TEXT_BOUNDARY_LINE_START: - gtk_text_iter_forward_line (end); - *start = *end; - gtk_text_iter_forward_line (end); - break; - - case ATK_TEXT_BOUNDARY_LINE_END: - gtk_text_iter_forward_line (start); - *end = *start; - if (!gtk_text_iter_is_end (start)) - { - while (!gtk_text_iter_ends_line (start)) - { - if (!gtk_text_iter_backward_char (start)) - break; - } - gtk_text_iter_forward_to_line_end (end); - } - break; - default: - g_assert_not_reached (); - break; - } -} - static GtkTextTag * get_tag_for_attributes (PangoAttrIterator *iter) { diff --git a/gtk/gtktextbufferprivate.h b/gtk/gtktextbufferprivate.h index 8386950344..87b2741cfe 100644 --- a/gtk/gtktextbufferprivate.h +++ b/gtk/gtktextbufferprivate.h @@ -34,22 +34,6 @@ const PangoLogAttr* _gtk_text_buffer_get_line_log_attrs (GtkTextBuffer *buff void _gtk_text_buffer_notify_will_remove_tag (GtkTextBuffer *buffer, GtkTextTag *tag); -void _gtk_text_buffer_get_text_before (GtkTextBuffer *buffer, - AtkTextBoundary boundary_type, - GtkTextIter *position, - GtkTextIter *start, - GtkTextIter *end); -void _gtk_text_buffer_get_text_at (GtkTextBuffer *buffer, - AtkTextBoundary boundary_type, - GtkTextIter *position, - GtkTextIter *start, - GtkTextIter *end); -void _gtk_text_buffer_get_text_after (GtkTextBuffer *buffer, - AtkTextBoundary boundary_type, - GtkTextIter *position, - GtkTextIter *start, - GtkTextIter *end); - G_END_DECLS #endif diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index f9d1ae8a2a..707aac23f4 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -56,8 +56,6 @@ #include "gtknative.h" #include "gtkwidgetprivate.h" -#include "a11y/gtktextviewaccessibleprivate.h" - /** * SECTION:gtktextview * @Short_description: Widget that displays a GtkTextBuffer @@ -1802,7 +1800,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass) "move-focus", "(i)", GTK_DIR_TAB_BACKWARD); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TEXT_VIEW_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("textview")); quark_text_selection_data = g_quark_from_static_string ("gtk-text-view-text-selection-data"); @@ -2143,7 +2140,6 @@ gtk_text_view_set_buffer (GtkTextView *text_view, gtk_widget_action_set_enabled (GTK_WIDGET (text_view), "text.redo", can_redo); } - _gtk_text_view_accessible_set_buffer (text_view, old_buffer); if (old_buffer) g_object_unref (old_buffer); diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 07b16454d6..1968272dcf 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -34,9 +34,6 @@ #include "gtkprivate.h" #include "gtkstylecontext.h" -#include "a11y/gtktogglebuttonaccessible.h" - - /** * SECTION:gtktogglebutton * @Short_description: Create buttons which retain their state @@ -181,7 +178,6 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) NULL, G_TYPE_NONE, 0); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("button")); } diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index 6eb1472a51..27ab711ef5 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -34,7 +34,6 @@ #include "gtktooltipwindowprivate.h" #include "gtkwindowprivate.h" #include "gtkwidgetprivate.h" -#include "gtkaccessible.h" #include "gtknative.h" /** diff --git a/gtk/gtktooltipwindow.c b/gtk/gtktooltipwindow.c index c30ebf1616..877738117c 100644 --- a/gtk/gtktooltipwindow.c +++ b/gtk/gtktooltipwindow.c @@ -29,7 +29,6 @@ #include "gtkprivate.h" #include "gtkintl.h" -#include "gtkaccessible.h" #include "gtkbox.h" #include "gtkimage.h" #include "gtklabel.h" @@ -382,7 +381,6 @@ gtk_tooltip_window_class_init (GtkTooltipWindowClass *klass) widget_class->hide = gtk_tooltip_window_hide; gtk_widget_class_set_css_name (widget_class, I_("tooltip")); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_TOOL_TIP); gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtktooltipwindow.ui"); gtk_widget_class_bind_template_child (widget_class, GtkTooltipWindow, box); diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index fc1e27039b..da4dfe844e 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -24,7 +24,6 @@ #include "gtkintl.h" #include "gtkprivate.h" #include "gtktypebuiltins.h" -#include "a11y/gtktreeviewaccessibleprivate.h" /** @@ -1560,12 +1559,10 @@ gtk_tree_selection_real_select_node (GtkTreeSelection *selection, if (!GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_IS_SELECTED)) { GTK_TREE_RBNODE_SET_FLAG (node, GTK_TREE_RBNODE_IS_SELECTED); - _gtk_tree_view_accessible_add_state (selection->tree_view, tree, node, GTK_CELL_RENDERER_SELECTED); } else { GTK_TREE_RBNODE_UNSET_FLAG (node, GTK_TREE_RBNODE_IS_SELECTED); - _gtk_tree_view_accessible_remove_state (selection->tree_view, tree, node, GTK_CELL_RENDERER_SELECTED); } gtk_widget_queue_draw (GTK_WIDGET (selection->tree_view)); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 8d03b23af7..5391b78172 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -65,8 +65,6 @@ #include "gtknative.h" #include "gtkpopover.h" -#include "a11y/gtktreeviewaccessibleprivate.h" - #include "gdk/gdkeventsprivate.h" #include "gdk/gdktextureprivate.h" @@ -1613,7 +1611,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) gtk_widget_class_add_binding_signal (widget_class, GDK_KEY_F, GDK_CONTROL_MASK, "start-interactive-search", NULL); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TREE_VIEW_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("treeview")); } @@ -8059,8 +8056,6 @@ gtk_tree_view_row_changed (GtkTreeModel *model, if (tree == NULL) goto done; - _gtk_tree_view_accessible_changed (tree_view, tree, node); - if (priv->fixed_height_mode && priv->fixed_height >= 0) { @@ -8186,8 +8181,6 @@ gtk_tree_view_row_inserted (GtkTreeModel *model, tmpnode = gtk_tree_rbtree_insert_after (tree, tmpnode, height, FALSE); } - _gtk_tree_view_accessible_add (tree_view, tree, tmpnode); - done: if (height > 0) { @@ -8248,12 +8241,10 @@ gtk_tree_view_row_has_child_toggled (GtkTreeModel *model, if (has_child) { GTK_TREE_RBNODE_SET_FLAG (node, GTK_TREE_RBNODE_IS_PARENT); - _gtk_tree_view_accessible_add_state (tree_view, tree, node, GTK_CELL_RENDERER_EXPANDABLE); } else { GTK_TREE_RBNODE_UNSET_FLAG (node, GTK_TREE_RBNODE_IS_PARENT); - _gtk_tree_view_accessible_remove_state (tree_view, tree, node, GTK_CELL_RENDERER_EXPANDABLE); } if (has_child && priv->is_list) @@ -8386,15 +8377,10 @@ gtk_tree_view_row_deleted (GtkTreeModel *model, if (priv->tree == tree) priv->tree = NULL; - _gtk_tree_view_accessible_remove_state (tree_view, - tree->parent_tree, tree->parent_node, - GTK_CELL_RENDERER_EXPANDED); - _gtk_tree_view_accessible_remove (tree_view, tree, NULL); gtk_tree_rbtree_remove (tree); } else { - _gtk_tree_view_accessible_remove (tree_view, tree, node); gtk_tree_rbtree_remove_node (tree, node); } @@ -8469,8 +8455,6 @@ gtk_tree_view_rows_reordered (GtkTreeModel *model, gtk_tree_rbtree_reorder (tree, new_order, len); - _gtk_tree_view_accessible_reorder (tree_view); - gtk_widget_queue_draw (GTK_WIDGET (tree_view)); gtk_tree_view_dy_to_top_row (tree_view); @@ -9208,10 +9192,6 @@ _gtk_tree_view_set_focus_column (GtkTreeView *tree_view, return; priv->focus_column = column; - - _gtk_tree_view_accessible_update_focus_column (tree_view, - old_column, - column); } /* x and y are the mouse position @@ -10378,7 +10358,6 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, { priv->tree = gtk_tree_rbtree_new (); gtk_tree_view_build_tree (tree_view, priv->tree, &iter, 1, FALSE); - _gtk_tree_view_accessible_add (tree_view, priv->tree, NULL); } gtk_tree_path_free (path); @@ -10388,14 +10367,6 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, gtk_tree_view_real_set_cursor (tree_view, NULL, CURSOR_INVALID); - { - GtkTreeViewAccessible *accessible = - GTK_TREE_VIEW_ACCESSIBLE (_gtk_widget_peek_accessible (GTK_WIDGET (tree_view))); - - if (accessible != NULL) - gtk_tree_view_accessible_update_model (accessible, priv->model); - } - g_object_notify_by_pspec (G_OBJECT (tree_view), tree_view_props[PROP_MODEL]); if (priv->selection) @@ -10723,7 +10694,6 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view, GtkTreeViewColumn *column) { GtkTreeViewPrivate *priv = gtk_tree_view_get_instance_private (tree_view); - guint position; g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1); g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1); @@ -10747,8 +10717,6 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view, G_CALLBACK (column_sizing_notify), tree_view); - position = g_list_index (priv->columns, column); - _gtk_tree_view_column_unset_tree_view (column); priv->columns = g_list_remove (priv->columns, column); @@ -10770,8 +10738,6 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view, gtk_widget_queue_resize (GTK_WIDGET (tree_view)); } - _gtk_tree_view_accessible_remove_column (tree_view, column, position); - g_object_unref (column); g_signal_emit (tree_view, tree_view_signals[COLUMNS_CHANGED], 0); @@ -10837,8 +10803,6 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view, gtk_widget_queue_resize (GTK_WIDGET (tree_view)); } - _gtk_tree_view_accessible_add_column (tree_view, column, position); - g_signal_emit (tree_view, tree_view_signals[COLUMNS_CHANGED], 0); return priv->n_columns; @@ -11059,8 +11023,6 @@ gtk_tree_view_move_column_after (GtkTreeView *tree_view, gtk_widget_queue_resize (GTK_WIDGET (tree_view)); - _gtk_tree_view_accessible_reorder_column (tree_view, column); - g_signal_emit (tree_view, tree_view_signals[COLUMNS_CHANGED], 0); } @@ -11539,11 +11501,6 @@ gtk_tree_view_real_expand_row (GtkTreeView *tree_view, gtk_tree_path_get_depth (path) + 1, open_all); - _gtk_tree_view_accessible_add (tree_view, node->children, NULL); - _gtk_tree_view_accessible_add_state (tree_view, - tree, node, - GTK_CELL_RENDERER_EXPANDED); - install_presize_handler (tree_view); g_signal_emit (tree_view, tree_view_signals[ROW_EXPANDED], 0, &iter, path); @@ -11676,11 +11633,6 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view, /* Stop a pending double click */ gtk_event_controller_reset (GTK_EVENT_CONTROLLER (priv->click_gesture)); - _gtk_tree_view_accessible_remove (tree_view, node->children, NULL); - _gtk_tree_view_accessible_remove_state (tree_view, - tree, node, - GTK_CELL_RENDERER_EXPANDED); - gtk_tree_rbtree_remove (node->children); if (cursor_changed) @@ -11905,13 +11857,7 @@ gtk_tree_view_real_set_cursor (GtkTreeView *tree_view, GtkTreeViewPrivate *priv = gtk_tree_view_get_instance_private (tree_view); if (!(flags & CURSOR_INVALID) && priv->cursor_node) - { - _gtk_tree_view_accessible_remove_state (tree_view, - priv->cursor_tree, - priv->cursor_node, - GTK_CELL_RENDERER_FOCUSED); - gtk_widget_queue_draw (GTK_WIDGET (tree_view)); - } + gtk_widget_queue_draw (GTK_WIDGET (tree_view)); /* One cannot set the cursor on a separator. Also, if * _gtk_tree_view_find_node returns TRUE, it ran out of tree @@ -11967,11 +11913,6 @@ gtk_tree_view_real_set_cursor (GtkTreeView *tree_view, priv->cursor_node); gtk_widget_queue_draw (GTK_WIDGET (tree_view)); } - - _gtk_tree_view_accessible_add_state (tree_view, - priv->cursor_tree, - priv->cursor_node, - GTK_CELL_RENDERER_FOCUSED); } if (!gtk_widget_in_destruction (GTK_WIDGET (tree_view))) diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index b1bc4d8eba..01313b1b7a 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -39,8 +39,6 @@ #include "gtkeventcontrollerfocus.h" #include "gtkeventcontrollerkey.h" -#include "a11y/gtktreeviewaccessibleprivate.h" - #include <string.h> @@ -1815,12 +1813,6 @@ gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column, if (priv->visible) _gtk_tree_view_column_cell_set_dirty (tree_column, TRUE); - if (priv->tree_view) - { - _gtk_tree_view_accessible_toggle_visibility (GTK_TREE_VIEW (priv->tree_view), - tree_column); - } - gtk_tree_view_column_update_button (tree_column); g_object_notify_by_pspec (G_OBJECT (tree_column), tree_column_props[PROP_VISIBLE]); } diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 6e7097ec1f..e9f6a8cda5 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -367,8 +367,6 @@ gtk_viewport_class_init (GtkViewportClass *class) widget_class->compute_expand = gtk_viewport_compute_expand; widget_class->get_request_mode = gtk_viewport_get_request_mode; - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_VIEWPORT); - /* GtkScrollable implementation */ g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment"); g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment"); diff --git a/gtk/gtkvolumebutton.c b/gtk/gtkvolumebutton.c index c9145749b9..feae0ca790 100644 --- a/gtk/gtkvolumebutton.c +++ b/gtk/gtkvolumebutton.c @@ -189,10 +189,6 @@ gtk_volume_button_init (GtkVolumeButton *button) GtkWidget *widget = GTK_WIDGET (button); gtk_widget_init_template (widget); - - /* The atk action description is not supported by GtkBuilder */ - atk_action_set_description (ATK_ACTION (gtk_widget_get_accessible (GTK_WIDGET (widget))), - 1, _("Adjusts the volume")); } /** diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 7a9cb2b478..56104548f2 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -27,7 +27,6 @@ #include "gtkwidgetprivate.h" #include "gtkaccelgroupprivate.h" -#include "gtkaccessible.h" #include "gtkactionobserverprivate.h" #include "gtkapplicationprivate.h" #include "gtkbuildable.h" @@ -74,7 +73,6 @@ #include "gtkwindowgroup.h" #include "gtkwindowprivate.h" -#include "a11y/gtkwidgetaccessibleprivate.h" #include "inspector/window.h" #include "gdk/gdkeventsprivate.h" @@ -262,29 +260,6 @@ * </object> * ]| * - * In addition to accelerators, GtkWidget also support a custom <accessible> - * element, which supports actions and relations. Properties on the accessible - * implementation of an object can be set by accessing the internal child - * “accessible” of a #GtkWidget. - * - * An example of a UI definition fragment specifying an accessible: - * |[ - * <object class="GtkLabel" id="label1"/> - * <property name="label">I am a Label for a Button</property> - * </object> - * <object class="GtkButton" id="button1"> - * <accessibility> - * <action action_name="click" translatable="yes">Click the button.</action> - * <relation target="label1" type="labelled-by"/> - * </accessibility> - * <child internal-child="accessible"> - * <object class="AtkObject" id="a11y-button1"> - * <property name="accessible-name">Clickable Button</property> - * </object> - * </child> - * </object> - * ]| - * * If the parent widget uses a #GtkLayoutManager, #GtkWidget supports a * custom <layout> element, used to define layout properties: * @@ -623,9 +598,6 @@ static void gtk_widget_real_measure (GtkWidget int *natural_baseline); static void gtk_widget_real_state_flags_changed (GtkWidget *widget, GtkStateFlags old_state); -static AtkObject* gtk_widget_real_get_accessible (GtkWidget *widget); -static void gtk_widget_accessible_interface_init (AtkImplementorIface *iface); -static AtkObject* gtk_widget_ref_accessible (AtkImplementor *implementor); static void gtk_widget_buildable_interface_init (GtkBuildableIface *iface); static void gtk_widget_buildable_set_name (GtkBuildable *buildable, @@ -708,13 +680,6 @@ gtk_widget_get_type (void) NULL, /* value_table */ }; - const GInterfaceInfo accessibility_info = - { - (GInterfaceInitFunc) gtk_widget_accessible_interface_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface data */ - }; - const GInterfaceInfo buildable_info = { (GInterfaceInitFunc) gtk_widget_buildable_interface_init, @@ -737,8 +702,6 @@ gtk_widget_get_type (void) GtkWidget_private_offset = g_type_add_instance_private (widget_type, sizeof (GtkWidgetPrivate)); - g_type_add_interface_static (widget_type, ATK_TYPE_IMPLEMENTOR, - &accessibility_info) ; g_type_add_interface_static (widget_type, GTK_TYPE_BUILDABLE, &buildable_info) ; g_type_add_interface_static (widget_type, GTK_TYPE_CONSTRAINT_TARGET, @@ -935,12 +898,6 @@ gtk_widget_class_init (GtkWidgetClass *klass) klass->query_tooltip = gtk_widget_real_query_tooltip; klass->css_changed = gtk_widget_real_css_changed; klass->system_setting_changed = gtk_widget_real_system_setting_changed; - - /* Accessibility support */ - klass->priv->accessible_type = GTK_TYPE_WIDGET_ACCESSIBLE; - klass->priv->accessible_role = ATK_ROLE_INVALID; - klass->get_accessible = gtk_widget_real_get_accessible; - klass->contains = gtk_widget_real_contains; widget_props[PROP_NAME] = @@ -2606,9 +2563,6 @@ gtk_widget_show (GtkWidget *widget) g_signal_emit (widget, widget_signals[SHOW], 0); g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_VISIBLE]); - if (priv->accessible != NULL) - gtk_widget_accessible_notify_visible (GTK_WIDGET_ACCESSIBLE (priv->accessible)); - gtk_widget_pop_verify_invariants (widget); g_object_unref (widget); } @@ -2669,9 +2623,6 @@ gtk_widget_hide (GtkWidget *widget) g_signal_emit (widget, widget_signals[HIDE], 0); g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_VISIBLE]); - if (priv->accessible != NULL) - gtk_widget_accessible_notify_visible (GTK_WIDGET_ACCESSIBLE (priv->accessible)); - parent = gtk_widget_get_parent (widget); if (parent) gtk_widget_queue_resize (parent); @@ -2731,16 +2682,11 @@ gtk_widget_map (GtkWidget *widget) if (!_gtk_widget_get_mapped (widget)) { - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - gtk_widget_push_verify_invariants (widget); if (!_gtk_widget_get_realized (widget)) gtk_widget_realize (widget); - if (priv->accessible != NULL) - gtk_widget_accessible_notify_showing (GTK_WIDGET_ACCESSIBLE (priv->accessible)); - g_signal_emit (widget, widget_signals[MAP], 0); update_cursor_on_state_change (widget); @@ -2765,8 +2711,6 @@ gtk_widget_unmap (GtkWidget *widget) if (_gtk_widget_get_mapped (widget)) { - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - g_object_ref (widget); gtk_widget_push_verify_invariants (widget); @@ -2775,9 +2719,6 @@ gtk_widget_unmap (GtkWidget *widget) g_signal_emit (widget, widget_signals[UNMAP], 0); - if (priv->accessible != NULL) - gtk_widget_accessible_notify_showing (GTK_WIDGET_ACCESSIBLE (priv->accessible)); - update_cursor_on_state_change (widget); gtk_widget_pop_verify_invariants (widget); @@ -3935,9 +3876,6 @@ gtk_widget_allocate (GtkWidget *widget, gtk_widget_update_paintables (widget); - if (priv->accessible != NULL) - gtk_widget_accessible_update_bounds (GTK_WIDGET_ACCESSIBLE (priv->accessible)); - skip_allocate: if (size_changed || baseline_changed) gtk_widget_queue_draw (widget); @@ -5614,9 +5552,6 @@ gtk_widget_set_sensitive (GtkWidget *widget, update_cursor_on_state_change (widget); } - if (priv->accessible != NULL) - gtk_widget_accessible_notify_sensitive (GTK_WIDGET_ACCESSIBLE (priv->accessible)); - g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_SENSITIVE]); } @@ -7102,9 +7037,7 @@ finalize_assertion_weak_ref (gpointer data, static void gtk_widget_real_destroy (GtkWidget *object) { - /* gtk_object_destroy() will already hold a refcount on object */ GtkWidget *widget = GTK_WIDGET (object); - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); if (g_object_get_qdata (G_OBJECT (widget), quark_auto_children)) { @@ -7211,13 +7144,6 @@ gtk_widget_real_destroy (GtkWidget *object) } } - if (priv->accessible) - { - gtk_accessible_set_widget (GTK_ACCESSIBLE (priv->accessible), NULL); - g_object_unref (priv->accessible); - priv->accessible = NULL; - } - /* Callers of add_mnemonic_label() should disconnect on ::destroy */ g_object_set_qdata (G_OBJECT (widget), quark_mnemonic_labels, NULL); @@ -7247,7 +7173,6 @@ gtk_widget_finalize (GObject *object) g_free (priv->tooltip_markup); g_free (priv->tooltip_text); - g_clear_object (&priv->accessible); g_clear_pointer (&priv->transform, gsk_transform_unref); g_clear_pointer (&priv->allocated_transform, gsk_transform_unref); @@ -7694,170 +7619,6 @@ G_DEFINE_BOXED_TYPE (GtkRequisition, gtk_requisition, gtk_requisition_copy, gtk_requisition_free) -/** - * gtk_widget_class_set_accessible_type: - * @widget_class: class to set the accessible type for - * @type: The object type that implements the accessible for @widget_class - * - * Sets the type to be used for creating accessibles for widgets of - * @widget_class. The given @type must be a subtype of the type used for - * accessibles of the parent class. - * - * This function should only be called from class init functions of widgets. - **/ -void -gtk_widget_class_set_accessible_type (GtkWidgetClass *widget_class, - GType type) -{ - GtkWidgetClassPrivate *priv; - - g_return_if_fail (GTK_IS_WIDGET_CLASS (widget_class)); - g_return_if_fail (g_type_is_a (type, widget_class->priv->accessible_type)); - - priv = widget_class->priv; - - priv->accessible_type = type; - /* reset this - honoring the type's role is better. */ - priv->accessible_role = ATK_ROLE_INVALID; -} - -/** - * gtk_widget_class_set_accessible_role: - * @widget_class: class to set the accessible role for - * @role: The role to use for accessibles created for @widget_class - * - * Sets the default #AtkRole to be set on accessibles created for - * widgets of @widget_class. Accessibles may decide to not honor this - * setting if their role reporting is more refined. Calls to - * gtk_widget_class_set_accessible_type() will reset this value. - * - * In cases where you want more fine-grained control over the role of - * accessibles created for @widget_class, you should provide your own - * accessible type and use gtk_widget_class_set_accessible_type() - * instead. - * - * If @role is #ATK_ROLE_INVALID, the default role will not be changed - * and the accessible’s default role will be used instead. - * - * This function should only be called from class init functions of widgets. - **/ -void -gtk_widget_class_set_accessible_role (GtkWidgetClass *widget_class, - AtkRole role) -{ - GtkWidgetClassPrivate *priv; - - g_return_if_fail (GTK_IS_WIDGET_CLASS (widget_class)); - - priv = widget_class->priv; - - priv->accessible_role = role; -} - -/** - * _gtk_widget_peek_accessible: - * @widget: a #GtkWidget - * - * Gets the accessible for @widget, if it has been created yet. - * Otherwise, this function returns %NULL. If the @widget’s implementation - * does not use the default way to create accessibles, %NULL will always be - * returned. - * - * Returns: (nullable): the accessible for @widget or %NULL if none has been - * created yet. - **/ -AtkObject * -_gtk_widget_peek_accessible (GtkWidget *widget) -{ - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - - return priv->accessible; -} - -/** - * gtk_widget_get_accessible: - * @widget: a #GtkWidget - * - * Returns the accessible object that describes the widget to an - * assistive technology. - * - * If accessibility support is not available, this #AtkObject - * instance may be a no-op. Likewise, if no class-specific #AtkObject - * implementation is available for the widget instance in question, - * it will inherit an #AtkObject implementation from the first ancestor - * class for which such an implementation is defined. - * - * The documentation of the - * [ATK](http://developer.gnome.org/atk/stable/) - * library contains more information about accessible objects and their uses. - * - * Returns: (transfer none): the #AtkObject associated with @widget - */ -AtkObject* -gtk_widget_get_accessible (GtkWidget *widget) -{ - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - - return GTK_WIDGET_GET_CLASS (widget)->get_accessible (widget); -} - -static AtkObject* -gtk_widget_real_get_accessible (GtkWidget *widget) -{ - AtkObject* accessible; - - accessible = widget->priv->accessible; - - if (!accessible) - { - GtkWidgetClass *widget_class; - GtkWidgetClassPrivate *priv; - - widget_class = GTK_WIDGET_GET_CLASS (widget); - priv = widget_class->priv; - - accessible = g_object_new (priv->accessible_type, - "widget", widget, - NULL); - if (priv->accessible_role != ATK_ROLE_INVALID) - atk_object_set_role (accessible, priv->accessible_role); - - widget->priv->accessible = accessible; - - atk_object_initialize (accessible, widget); - - /* Set the role again, since we don't want a role set - * in some parent initialize() function to override - * our own. - */ - if (priv->accessible_role != ATK_ROLE_INVALID) - atk_object_set_role (accessible, priv->accessible_role); - } - - return accessible; -} - -/* - * Initialize an AtkImplementorIface instance’s virtual pointers as - * appropriate to this implementor’s class (GtkWidget). - */ -static void -gtk_widget_accessible_interface_init (AtkImplementorIface *iface) -{ - iface->ref_accessible = gtk_widget_ref_accessible; -} - -static AtkObject* -gtk_widget_ref_accessible (AtkImplementor *implementor) -{ - AtkObject *accessible; - - accessible = gtk_widget_get_accessible (GTK_WIDGET (implementor)); - if (accessible) - g_object_ref (accessible); - return accessible; -} - /* * Expand flag management */ @@ -8280,7 +8041,6 @@ gtk_widget_set_vexpand_set (GtkWidget *widget, /* * GtkBuildable implementation */ -static GQuark quark_builder_atk_relations = 0; static GQuark quark_builder_set_name = 0; static void @@ -8311,7 +8071,6 @@ gtk_widget_buildable_add_child (GtkBuildable *buildable, static void gtk_widget_buildable_interface_init (GtkBuildableIface *iface) { - quark_builder_atk_relations = g_quark_from_static_string ("gtk-builder-atk-relations"); quark_builder_set_name = g_quark_from_static_string ("gtk-builder-set-name"); iface->set_name = gtk_widget_buildable_set_name; @@ -8347,9 +8106,6 @@ gtk_widget_buildable_get_internal_child (GtkBuildable *buildable, GSList *l; GType internal_child_type = 0; - if (strcmp (childname, "accessible") == 0) - return G_OBJECT (gtk_widget_get_accessible (GTK_WIDGET (buildable))); - /* Find a widget type which has declared an automated child as internal by * the name 'childname', if any. */ @@ -8381,242 +8137,12 @@ gtk_widget_buildable_get_internal_child (GtkBuildable *buildable, return NULL; } -typedef struct -{ - char *action_name; - GString *description; - char *context; - gboolean translatable; -} AtkActionData; - -typedef struct -{ - char *target; - AtkRelationType type; - int line; - int col; -} AtkRelationData; - -static void -free_action (AtkActionData *data, gpointer user_data) -{ - g_free (data->action_name); - g_string_free (data->description, TRUE); - g_free (data->context); - g_slice_free (AtkActionData, data); -} - -static void -free_relation (AtkRelationData *data, gpointer user_data) -{ - g_free (data->target); - g_slice_free (AtkRelationData, data); -} - static void gtk_widget_buildable_parser_finished (GtkBuildable *buildable, GtkBuilder *builder) { - GSList *atk_relations; - - atk_relations = g_object_get_qdata (G_OBJECT (buildable), - quark_builder_atk_relations); - if (atk_relations) - { - AtkObject *accessible; - AtkRelationSet *relation_set; - GSList *l; - GObject *target; - AtkObject *target_accessible; - - accessible = gtk_widget_get_accessible (GTK_WIDGET (buildable)); - relation_set = atk_object_ref_relation_set (accessible); - - for (l = atk_relations; l; l = l->next) - { - AtkRelationData *relation = (AtkRelationData*)l->data; - - target = _gtk_builder_lookup_object (builder, relation->target, relation->line, relation->col); - if (!target) - continue; - target_accessible = gtk_widget_get_accessible (GTK_WIDGET (target)); - g_assert (target_accessible != NULL); - - atk_relation_set_add_relation_by_type (relation_set, relation->type, target_accessible); - } - g_object_unref (relation_set); - - g_slist_free_full (atk_relations, (GDestroyNotify) free_relation); - g_object_steal_qdata (G_OBJECT (buildable), quark_builder_atk_relations); - } -} - -typedef struct -{ - GtkBuilder *builder; - GSList *actions; - GSList *relations; - AtkRole role; -} AccessibilitySubParserData; - -static void -accessibility_start_element (GtkBuildableParseContext *context, - const char *element_name, - const char **names, - const char **values, - gpointer user_data, - GError **error) -{ - AccessibilitySubParserData *data = (AccessibilitySubParserData*)user_data; - - if (strcmp (element_name, "relation") == 0) - { - char *target = NULL; - char *type = NULL; - AtkRelationData *relation; - AtkRelationType relation_type; - - if (!_gtk_builder_check_parent (data->builder, context, "accessibility", error)) - return; - - if (!g_markup_collect_attributes (element_name, names, values, error, - G_MARKUP_COLLECT_STRING, "target", &target, - G_MARKUP_COLLECT_STRING, "type", &type, - G_MARKUP_COLLECT_INVALID)) - { - _gtk_builder_prefix_error (data->builder, context, error); - return; - } - - relation_type = atk_relation_type_for_name (type); - if (relation_type == ATK_RELATION_NULL) - { - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_VALUE, - "No such relation type: '%s'", type); - _gtk_builder_prefix_error (data->builder, context, error); - return; - } - - relation = g_slice_new (AtkRelationData); - relation->target = g_strdup (target); - relation->type = relation_type; - - data->relations = g_slist_prepend (data->relations, relation); - } - else if (strcmp (element_name, "action") == 0) - { - const char *action_name; - const char *description = NULL; - const char *msg_context = NULL; - gboolean translatable = FALSE; - AtkActionData *action; - - if (!_gtk_builder_check_parent (data->builder, context, "accessibility", error)) - return; - - if (!g_markup_collect_attributes (element_name, names, values, error, - G_MARKUP_COLLECT_STRING, "action_name", &action_name, - G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "description", &description, - G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "comments", NULL, - G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "context", &msg_context, - G_MARKUP_COLLECT_BOOLEAN|G_MARKUP_COLLECT_OPTIONAL, "translatable", &translatable, - G_MARKUP_COLLECT_INVALID)) - { - _gtk_builder_prefix_error (data->builder, context, error); - return; - } - - action = g_slice_new (AtkActionData); - action->action_name = g_strdup (action_name); - action->description = g_string_new (description); - action->context = g_strdup (msg_context); - action->translatable = translatable; - - data->actions = g_slist_prepend (data->actions, action); - } - else if (strcmp (element_name, "role") == 0) - { - const char *type; - AtkRole role; - - if (!_gtk_builder_check_parent (data->builder, context, "accessibility", error)) - return; - - if (data->role != ATK_ROLE_INVALID) - { - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_VALUE, - "Duplicate accessibility role definition"); - _gtk_builder_prefix_error (data->builder, context, error); - return; - } - - if (!g_markup_collect_attributes (element_name, names, values, error, - G_MARKUP_COLLECT_STRING, "type", &type, - G_MARKUP_COLLECT_INVALID)) - { - _gtk_builder_prefix_error (data->builder, context, error); - return; - } - - role = atk_role_for_name (type); - if (role == ATK_ROLE_INVALID) - { - g_set_error (error, - GTK_BUILDER_ERROR, - GTK_BUILDER_ERROR_INVALID_VALUE, - "No such role type: '%s'", type); - _gtk_builder_prefix_error (data->builder, context, error); - return; - } - - data->role = role; - } - else if (strcmp (element_name, "accessibility") == 0) - { - if (!_gtk_builder_check_parent (data->builder, context, "object", error)) - return; - - if (!g_markup_collect_attributes (element_name, names, values, error, - G_MARKUP_COLLECT_INVALID, NULL, NULL, - G_MARKUP_COLLECT_INVALID)) - _gtk_builder_prefix_error (data->builder, context, error); - } - else - { - _gtk_builder_error_unhandled_tag (data->builder, context, - "GtkWidget", element_name, - error); - } -} - -static void -accessibility_text (GtkBuildableParseContext *context, - const char *text, - gsize text_len, - gpointer user_data, - GError **error) -{ - AccessibilitySubParserData *data = (AccessibilitySubParserData*)user_data; - - if (strcmp (gtk_buildable_parse_context_get_element (context), "action") == 0) - { - AtkActionData *action = data->actions->data; - - g_string_append_len (action->description, text, text_len); - } } -static const GtkBuildableParser accessibility_parser = - { - accessibility_start_element, - NULL, - accessibility_text, - }; - typedef struct { GtkBuilder *builder; @@ -8820,19 +8346,6 @@ gtk_widget_buildable_custom_tag_start (GtkBuildable *buildable, GtkBuildableParser *parser, gpointer *parser_data) { - if (strcmp (tagname, "accessibility") == 0) - { - AccessibilitySubParserData *data; - - data = g_slice_new0 (AccessibilitySubParserData); - data->builder = builder; - - *parser = accessibility_parser; - *parser_data = data; - - return TRUE; - } - if (strcmp (tagname, "style") == 0) { StyleParserData *data; @@ -8945,69 +8458,7 @@ gtk_widget_buildable_custom_finished (GtkBuildable *buildable, const char *tagname, gpointer user_data) { - if (strcmp (tagname, "accessibility") == 0) - { - AccessibilitySubParserData *a11y_data; - - a11y_data = (AccessibilitySubParserData*)user_data; - - if (a11y_data->actions) - { - AtkObject *accessible; - AtkAction *action; - int i, n_actions; - GSList *l; - - accessible = gtk_widget_get_accessible (GTK_WIDGET (buildable)); - - if (ATK_IS_ACTION (accessible)) - { - action = ATK_ACTION (accessible); - n_actions = atk_action_get_n_actions (action); - - for (l = a11y_data->actions; l; l = l->next) - { - AtkActionData *action_data = (AtkActionData*)l->data; - - for (i = 0; i < n_actions; i++) - if (strcmp (atk_action_get_name (action, i), - action_data->action_name) == 0) - break; - - if (i < n_actions) - { - const char *description; - - if (action_data->translatable && action_data->description->len) - description = _gtk_builder_parser_translate (gtk_builder_get_translation_domain (builder), - action_data->context, - action_data->description->str); - else - description = action_data->description->str; - - atk_action_set_description (action, i, description); - } - } - } - else - g_warning ("accessibility action on a widget that does not implement AtkAction"); - - g_slist_free_full (a11y_data->actions, (GDestroyNotify) free_action); - } - - if (a11y_data->relations) - g_object_set_qdata (G_OBJECT (buildable), quark_builder_atk_relations, - a11y_data->relations); - - if (a11y_data->role != ATK_ROLE_INVALID) - { - AtkObject *accessible = gtk_widget_get_accessible (GTK_WIDGET (buildable)); - atk_object_set_role (accessible, a11y_data->role); - } - - g_slice_free (AccessibilitySubParserData, a11y_data); - } - else if (strcmp (tagname, "style") == 0) + if (strcmp (tagname, "style") == 0) { StyleParserData *style_data = (StyleParserData *)user_data; GSList *l; @@ -9649,9 +9100,6 @@ gtk_widget_set_has_tooltip (GtkWidget *widget, { priv->has_tooltip = has_tooltip; - if (priv->accessible != NULL) - gtk_widget_accessible_notify_tooltip (GTK_WIDGET_ACCESSIBLE (priv->accessible)); - g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HAS_TOOLTIP]); } } @@ -10201,9 +9649,6 @@ gtk_widget_set_has_focus (GtkWidget *widget, priv->has_focus = has_focus; - if (priv->accessible != NULL) - gtk_widget_accessible_notify_focus (GTK_WIDGET_ACCESSIBLE (priv->accessible)); - g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HAS_FOCUS]); } @@ -12607,8 +12052,6 @@ void gtk_widget_update_orientation (GtkWidget *widget, GtkOrientation orientation) { - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - g_return_if_fail (GTK_IS_WIDGET (widget)); if (orientation == GTK_ORIENTATION_HORIZONTAL) @@ -12621,7 +12064,4 @@ gtk_widget_update_orientation (GtkWidget *widget, gtk_widget_add_css_class (widget, GTK_STYLE_CLASS_VERTICAL); gtk_widget_remove_css_class (widget, GTK_STYLE_CLASS_HORIZONTAL); } - - if (priv->accessible != NULL) - gtk_widget_accessible_notify_orientation (GTK_WIDGET_ACCESSIBLE (priv->accessible)); } diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 771e584ab4..c53198e0f9 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -36,7 +36,6 @@ #include <gtk/gtkshortcut.h> #include <gtk/gtkshortcutaction.h> #include <gtk/gtktypes.h> -#include <atk/atk.h> G_BEGIN_DECLS @@ -183,8 +182,6 @@ struct _GtkWidget * @set_focus_child: Sets the focused child of a widget. Must chain up * @move_focus: Signal emitted when a change of focus is requested * @keynav_failed: Signal emitted if keyboard navigation fails. - * @get_accessible: Returns the accessible object that describes the - * widget to an assistive technology. * @query_tooltip: Signal emitted when “has-tooltip” is %TRUE and the * hover timeout has expired with the cursor hovering “above” * widget; or emitted when widget got focus in keyboard mode. @@ -251,10 +248,6 @@ struct _GtkWidgetClass gboolean (* keynav_failed) (GtkWidget *widget, GtkDirectionType direction); - /* accessibility support - */ - AtkObject * (* get_accessible) (GtkWidget *widget); - gboolean (* query_tooltip) (GtkWidget *widget, int x, int y, @@ -587,17 +580,6 @@ GDK_AVAILABLE_IN_ALL gboolean gtk_widget_compute_expand (GtkWidget *widget, GtkOrientation orientation); -/* Accessibility support */ -GDK_AVAILABLE_IN_ALL -void gtk_widget_class_set_accessible_type (GtkWidgetClass *widget_class, - GType type); -GDK_AVAILABLE_IN_ALL -void gtk_widget_class_set_accessible_role (GtkWidgetClass *widget_class, - AtkRole role); -GDK_AVAILABLE_IN_ALL -AtkObject* gtk_widget_get_accessible (GtkWidget *widget); - - /* Margin and alignment */ GDK_AVAILABLE_IN_ALL GtkAlign gtk_widget_get_halign (GtkWidget *widget); diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index 01090956ad..be51038ade 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -172,8 +172,6 @@ struct _GtkWidgetPrivate GPtrArray *controllers; - AtkObject *accessible; - /* Widget tree */ GtkWidget *parent; GtkWidget *prev_sibling; @@ -206,8 +204,6 @@ struct _GtkWidgetClassPrivate { GtkWidgetTemplate *template; GListStore *shortcuts; - GType accessible_type; - AtkRole accessible_role; GQuark css_name; GType layout_manager_type; GtkWidgetAction *actions; @@ -234,8 +230,6 @@ void _gtk_widget_remove_sizegroup (GtkWidget *widget, gpointer group); GSList *_gtk_widget_get_sizegroups (GtkWidget *widget); -AtkObject * _gtk_widget_peek_accessible (GtkWidget *widget); - void _gtk_widget_set_has_default (GtkWidget *widget, gboolean has_default); void _gtk_widget_set_has_grab (GtkWidget *widget, diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 274b6d7ab9..a0fdd39229 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -65,7 +65,6 @@ #include "gtkcssboxesimplprivate.h" #include "gtktooltipprivate.h" -#include "a11y/gtkwindowaccessibleprivate.h" #include "inspector/window.h" #include "gdk/gdktextureprivate.h" @@ -1114,8 +1113,6 @@ gtk_window_class_init (GtkWindowClass *klass) add_tab_bindings (widget_class, GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD); add_tab_bindings (widget_class, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD); - gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_WINDOW_ACCESSIBLE); - gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FRAME); gtk_widget_class_set_css_name (widget_class, I_("window")); } @@ -6393,7 +6390,6 @@ _gtk_window_set_is_active (GtkWindow *window, priv->is_active = is_active; g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_IS_ACTIVE]); - _gtk_window_accessible_set_is_active (window, is_active); } /** diff --git a/gtk/gtkwindowcontrols.c b/gtk/gtkwindowcontrols.c index 78236cb43e..47978330ef 100644 --- a/gtk/gtkwindowcontrols.c +++ b/gtk/gtkwindowcontrols.c @@ -20,7 +20,6 @@ #include "gtkwindowcontrols.h" -#include "gtkaccessible.h" #include "gtkactionable.h" #include "gtkboxlayout.h" #include "gtkbutton.h" @@ -277,7 +276,6 @@ update_window_buttons (GtkWindowControls *self) { GtkWidget *button = NULL; GtkWidget *image = NULL; - AtkObject *accessible; if (strcmp (tokens[i], "icon") == 0 && is_sovereign_window) @@ -305,10 +303,6 @@ update_window_buttons (GtkWindowControls *self) gtk_widget_set_can_focus (button, FALSE); gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "window.minimize"); - - accessible = gtk_widget_get_accessible (button); - if (GTK_IS_ACCESSIBLE (accessible)) - atk_object_set_name (accessible, _("Minimize")); } else if (strcmp (tokens[i], "maximize") == 0 && resizable && @@ -326,10 +320,6 @@ update_window_buttons (GtkWindowControls *self) gtk_widget_set_can_focus (button, FALSE); gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "window.toggle-maximized"); - - accessible = gtk_widget_get_accessible (button); - if (GTK_IS_ACCESSIBLE (accessible)) - atk_object_set_name (accessible, maximized ? _("Restore") : _("Maximize")); } else if (strcmp (tokens[i], "close") == 0 && deletable) @@ -343,10 +333,6 @@ update_window_buttons (GtkWindowControls *self) gtk_widget_set_can_focus (button, FALSE); gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "window.close"); - - accessible = gtk_widget_get_accessible (button); - if (GTK_IS_ACCESSIBLE (accessible)) - atk_object_set_name (accessible, _("Close")); } if (button) diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c index ffab43a93b..d2bb6d9503 100644 --- a/gtk/inspector/misc-info.c +++ b/gtk/inspector/misc-info.c @@ -72,12 +72,6 @@ struct _GtkInspectorMiscInfo GtkWidget *framerate; GtkWidget *framecount_row; GtkWidget *framecount; - GtkWidget *accessible_role_row; - GtkWidget *accessible_role; - GtkWidget *accessible_name_row; - GtkWidget *accessible_name; - GtkWidget *accessible_description_row; - GtkWidget *accessible_description; GtkWidget *mapped_row; GtkWidget *mapped; GtkWidget *realized_row; @@ -329,8 +323,6 @@ update_info (gpointer data) if (GTK_IS_WIDGET (sl->object)) { GtkWidget *child; - AtkObject *accessible; - AtkRole role; GList *list, *l; while ((child = gtk_widget_get_first_child (sl->mnemonic_label))) @@ -352,16 +344,6 @@ update_info (gpointer data) g_list_free (list); gtk_widget_set_visible (sl->tick_callback, gtk_widget_has_tick_callback (GTK_WIDGET (sl->object))); - - accessible = ATK_OBJECT (gtk_widget_get_accessible (GTK_WIDGET (sl->object))); - role = atk_object_get_role (accessible); - gtk_label_set_text (GTK_LABEL (sl->accessible_role), atk_role_get_name (role)); - gtk_label_set_text (GTK_LABEL (sl->accessible_name), atk_object_get_name (accessible)); - gtk_label_set_text (GTK_LABEL (sl->accessible_description), atk_object_get_description (accessible)); - gtk_widget_set_visible (sl->mapped, gtk_widget_get_mapped (GTK_WIDGET (sl->object))); - gtk_widget_set_visible (sl->realized, gtk_widget_get_realized (GTK_WIDGET (sl->object))); - gtk_widget_set_visible (sl->is_toplevel, GTK_IS_ROOT (sl->object)); - gtk_widget_set_visible (sl->child_visible, gtk_widget_get_child_visible (GTK_WIDGET (sl->object))); } update_surface (sl); @@ -441,9 +423,6 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl, gtk_widget_show (sl->baseline_row); gtk_widget_show (sl->mnemonic_label_row); gtk_widget_show (sl->tick_callback_row); - gtk_widget_show (sl->accessible_role_row); - gtk_widget_show (sl->accessible_name_row); - gtk_widget_show (sl->accessible_description_row); gtk_widget_show (sl->mapped_row); gtk_widget_show (sl->realized_row); gtk_widget_show (sl->is_toplevel_row); @@ -463,9 +442,6 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl, gtk_widget_hide (sl->allocated_size_row); gtk_widget_hide (sl->baseline_row); gtk_widget_hide (sl->tick_callback_row); - gtk_widget_hide (sl->accessible_role_row); - gtk_widget_hide (sl->accessible_name_row); - gtk_widget_hide (sl->accessible_description_row); gtk_widget_hide (sl->mapped_row); gtk_widget_hide (sl->realized_row); gtk_widget_hide (sl->is_toplevel_row); @@ -583,12 +559,6 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, framecount); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, framerate_row); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, framerate); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, accessible_role_row); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, accessible_role); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, accessible_name_row); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, accessible_name); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, accessible_description_row); - gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, accessible_description); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, mapped_row); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, mapped); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, realized_row); @@ -606,4 +576,3 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass) } // vim: set et sw=2 ts=2: - diff --git a/gtk/inspector/misc-info.ui b/gtk/inspector/misc-info.ui index e19d381eb3..ca7fbc9639 100644 --- a/gtk/inspector/misc-info.ui +++ b/gtk/inspector/misc-info.ui @@ -488,97 +488,6 @@ </object> </child> <child> - <object class="GtkListBoxRow" id="accessible_role_row"> - <property name="activatable">0</property> - <child> - <object class="GtkBox"> - <property name="margin-start">10</property> - <property name="margin-end">10</property> - <property name="margin-top">10</property> - <property name="margin-bottom">10</property> - <property name="spacing">40</property> - <child> - <object class="GtkLabel"> - <property name="label" translatable="yes">Accessible Role</property> - <property name="halign">start</property> - <property name="valign">baseline</property> - <property name="xalign">0</property> - <property name="hexpand">1</property> - </object> - </child> - <child> - <object class="GtkLabel" id="accessible_role"> - <property name="halign">end</property> - <property name="valign">baseline</property> - </object> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkListBoxRow" id="accessible_name_row"> - <property name="activatable">0</property> - <child> - <object class="GtkBox"> - <property name="margin-start">10</property> - <property name="margin-end">10</property> - <property name="margin-top">10</property> - <property name="margin-bottom">10</property> - <property name="spacing">40</property> - <child> - <object class="GtkLabel"> - <property name="label" translatable="yes">Accessible Name</property> - <property name="halign">start</property> - <property name="valign">baseline</property> - <property name="xalign">0</property> - <property name="hexpand">1</property> - </object> - </child> - <child> - <object class="GtkLabel" id="accessible_name"> - <property name="halign">end</property> - <property name="valign">baseline</property> - <property name="ellipsize">end</property> - <property name="max-width-chars">50</property> - </object> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkListBoxRow" id="accessible_description_row"> - <property name="activatable">0</property> - <child> - <object class="GtkBox"> - <property name="margin-start">10</property> - <property name="margin-end">10</property> - <property name="margin-top">10</property> - <property name="margin-bottom">10</property> - <property name="spacing">40</property> - <child> - <object class="GtkLabel"> - <property name="label" translatable="yes">Accessible Description</property> - <property name="halign">start</property> - <property name="valign">baseline</property> - <property name="xalign">0</property> - <property name="hexpand">1</property> - </object> - </child> - <child> - <object class="GtkLabel" id="accessible_description"> - <property name="halign">end</property> - <property name="valign">baseline</property> - <property name="ellipsize">end</property> - <property name="max-width-chars">50</property> - </object> - </child> - </object> - </child> - </object> - </child> - <child> <object class="GtkListBoxRow" id="mapped_row"> <property name="activatable">0</property> <child> diff --git a/gtk/meson.build b/gtk/meson.build index 2e68135422..4ad1796e62 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -1,5 +1,4 @@ subdir('deprecated') -subdir('a11y') subdir('inspector') gtk_cargs = [ @@ -150,7 +149,6 @@ gtk_public_sources = files([ 'gtkaboutdialog.c', 'gtkaccelgroup.c', 'gtkaccellabel.c', - 'gtkaccessible.c', 'gtkactionable.c', 'gtkactionbar.c', 'gtkadjustment.c', @@ -438,7 +436,6 @@ gtk_public_headers = files([ 'gtkaboutdialog.h', 'gtkaccelgroup.h', 'gtkaccellabel.h', - 'gtkaccessible.h', 'gtkactionable.h', 'gtkactionbar.h', 'gtkadjustment.h', @@ -688,7 +685,6 @@ gtk_public_headers = files([ 'gtkwindowcontrols.h', 'gtkwindowgroup.h', 'gtkwindowhandle.h', - 'gtk-a11y.h', 'gtk-autocleanups.h', 'gtk.h', ]) @@ -884,7 +880,7 @@ gtkmarshalers = gnome.genmarshal('gtkmarshalers', gtkmarshal_h = gtkmarshalers[1] gtktypebuiltins = gnome.mkenums('gtktypebuiltins', - sources: gtk_public_headers + gtk_deprecated_headers + a11y_headers, + sources: gtk_public_headers + gtk_deprecated_headers, c_template: 'gtktypebuiltins.c.template', h_template: 'gtktypebuiltins.h.template', install_dir: join_paths(gtk_includedir, 'gtk-4.0/gtk'), @@ -944,7 +940,6 @@ gtk_sources += [ gtk_dbus_src, gtk_deprecated_sources, inspector_sources, - a11y_sources, gtkresources, gtkmarshalers, gtkprivatetypebuiltins, @@ -963,7 +958,6 @@ gtk_deps = [ cairo_dep, fontconfig_dep, pixbuf_dep, - atk_dep, epoxy_dep, libm, graphene_dep, @@ -1014,8 +1008,6 @@ if win32_enabled win32res = import('windows').compile_resources(gtkwin32rc, include_directories : win32rcinc) gtk_sources += win32res -else - gtk_deps += [ atkbridge_dep, ] endif # So we don't add these twice @@ -1165,8 +1157,6 @@ if build_gir gtk_css_public_sources, gtk_deprecated_headers, gtk_deprecated_sources, - a11y_headers, - a11y_sources, gtktypebuiltins_h, gtkversion, ] @@ -1186,13 +1176,12 @@ if build_gir identifier_prefix: 'Gtk', symbol_prefix: 'gtk', export_packages: 'gtk4', - includes: [ gdk_gir[0], gsk_gir[0], 'Atk-1.0', ], + includes: [ gdk_gir[0], gsk_gir[0], ], header: 'gtk/gtk.h', install: true, dependencies: gsk_gir_dep, extra_args: gir_args + [ '-DGTK_COMPILATION', - '--c-include=gtk/gtk-a11y.h', ]) gtk_dep_sources += gtk_gir endif diff --git a/gtk/ui/gtkcoloreditor.ui b/gtk/ui/gtkcoloreditor.ui index a66a29adb6..9c8b4da03a 100644 --- a/gtk/ui/gtkcoloreditor.ui +++ b/gtk/ui/gtkcoloreditor.ui @@ -66,11 +66,6 @@ </child> <child> <object class="GtkEntry" id="entry"> - <child internal-child="accessible"> - <object class="AtkObject" id="entry-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Color Name</property> - </object> - </child> <signal name="activate" handler="entry_apply" swapped="no"/> <signal name="notify::has-focus" handler="entry_focus_changed" swapped="no"/> <signal name="notify::text" handler="entry_text_changed" swapped="no"/> @@ -157,11 +152,6 @@ <property name="width-chars">2</property> <property name="max-width-chars">2</property> <property name="climb-rate">1</property> - <child internal-child="accessible"> - <object class="AtkObject" id="a_entry-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Alpha</property> - </object> - </child> <layout> <property name="left-attach">1</property> <property name="top-attach">0</property> @@ -198,11 +188,6 @@ <property name="width-chars">2</property> <property name="max-width-chars">2</property> <property name="climb-rate">1</property> - <child internal-child="accessible"> - <object class="AtkObject" id="h_entry-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Hue</property> - </object> - </child> <layout> <property name="left-attach">1</property> <property name="top-attach">0</property> @@ -249,11 +234,6 @@ <property name="width-chars">2</property> <property name="max-width-chars">2</property> <property name="climb-rate">1</property> - <child internal-child="accessible"> - <object class="AtkObject" id="s_entry-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Saturation</property> - </object> - </child> <layout> <property name="left-attach">1</property> <property name="top-attach">0</property> @@ -265,11 +245,6 @@ <property name="width-chars">2</property> <property name="max-width-chars">2</property> <property name="climb-rate">1</property> - <child internal-child="accessible"> - <object class="AtkObject" id="v_entry-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Value</property> - </object> - </child> <layout> <property name="left-attach">1</property> <property name="top-attach">1</property> diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui index 60eab69a72..4ad9078fb2 100644 --- a/gtk/ui/gtkfilechooserwidget.ui +++ b/gtk/ui/gtkfilechooserwidget.ui @@ -142,11 +142,6 @@ <object class="GtkTreeView" id="browse_files_tree_view"> <property name="has-tooltip">1</property> <property name="enable-search">0</property> - <child internal-child="accessible"> - <object class="AtkObject" id="browse_files_tree_view-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Files</property> - </object> - </child> <child> <object class="GtkGestureLongPress"> <property name="touch-only">1</property> diff --git a/gtk/ui/gtkprintunixdialog.ui b/gtk/ui/gtkprintunixdialog.ui index 6d086c9da8..775cdc9bce 100644 --- a/gtk/ui/gtkprintunixdialog.ui +++ b/gtk/ui/gtkprintunixdialog.ui @@ -202,9 +202,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="range_table"/> - </accessibility> </object> </child> <child> @@ -270,22 +267,12 @@ e.g. 1–3, 7, 11</property> <property name="activates-default">1</property> <signal name="notify::has-focus" handler="page_range_entry_focus_changed" swapped="no"/> - <child internal-child="accessible"> - <object class="AtkObject" id="page_range_entry-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Pages</property> - <property name="AtkObject::accessible-description" translatable="yes">Specify one or more page ranges, - e.g. 1–3, 7, 11</property> - </object> - </child> <layout> <property name="left-attach">1</property> <property name="top-attach">3</property> </layout> </object> </child> - <accessibility> - <relation type="labelled-by" target="label_widget1"/> - </accessibility> </object> </child> </object> @@ -303,9 +290,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="grid1"/> - </accessibility> </object> </child> <child> @@ -371,9 +355,6 @@ </layout> </object> </child> - <accessibility> - <relation type="labelled-by" target="label_widget2"/> - </accessibility> </object> </child> </object> @@ -415,9 +396,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="grid2"/> - </accessibility> </object> </child> <child> @@ -562,9 +540,6 @@ </layout> </object> </child> - <accessibility> - <relation type="labelled-by" target="label_widget3"/> - </accessibility> </object> </child> </object> @@ -582,9 +557,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="grid3"/> - </accessibility> </object> </child> <child> @@ -715,9 +687,6 @@ </layout> </object> </child> - <accessibility> - <relation type="labelled-by" target="label_widget4"/> - </accessibility> </object> </child> </object> @@ -766,9 +735,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="grid5"/> - </accessibility> </object> </child> <child> @@ -818,9 +784,6 @@ </layout> </object> </child> - <accessibility> - <relation type="labelled-by" target="label_widget5"/> - </accessibility> </object> </child> <layout> @@ -841,9 +804,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="grid6"/> - </accessibility> </object> </child> <child> @@ -891,13 +851,6 @@ e.g. 15∶30, 2∶35 pm, 14∶15∶20, 11∶46∶30 am, 4 pm</property> <property name="tooltip-text" translatable="yes" comments="Ability to parse the am/pm format depends on actual locale. You can remove the am/pm values below for your locale if they are not supported.">Specify the time of print, e.g. 15∶30, 2∶35 pm, 14∶15∶20, 11∶46∶30 am, 4 pm</property> - <child internal-child="accessible"> - <object class="AtkObject" id="print_at_entry-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Time of print</property> - <property name="AtkObject::accessible-description" translatable="yes">Specify the time of print, - e.g. 15∶30, 2∶35 pm, 14∶15∶20, 11∶46∶30 am, 4 pm</property> - </object> - </child> <signal name="changed" handler="update_print_at_option" object="GtkPrintUnixDialog" swapped="yes"/> <layout> <property name="left-attach">1</property> @@ -922,9 +875,6 @@ </layout> </object> </child> - <accessibility> - <relation type="labelled-by" target="label_widget6"/> - </accessibility> </object> </child> <layout> @@ -945,9 +895,6 @@ <attributes> <attribute name="weight" value="bold"></attribute> </attributes> - <accessibility> - <relation type="label-for" target="grid7"/> - </accessibility> </object> </child> <child> @@ -997,9 +944,6 @@ </layout> </object> </child> - <accessibility> - <relation type="labelled-by" target="label_widget7"/> - </accessibility> </object> </child> <layout> diff --git a/gtk/ui/gtkvolumebutton.ui b/gtk/ui/gtkvolumebutton.ui index 3c658df0c5..7b065d251e 100644 --- a/gtk/ui/gtkvolumebutton.ui +++ b/gtk/ui/gtkvolumebutton.ui @@ -13,32 +13,14 @@ audio-volume-high audio-volume-low audio-volume-medium</property> - <child internal-child="accessible"> - <object class="AtkObject" id="GtkVolumeButton-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Volume</property> - <property name="AtkObject::accessible-description" translatable="yes">Turns volume up or down</property> - </object> - </child> <signal name="query-tooltip" handler="cb_query_tooltip" swapped="no"/> <signal name="value-changed" handler="cb_value_changed" swapped="no"/> <child internal-child="plus_button"> <object class="GtkButton" id="scalebutton-plus_button1"> - <child internal-child="accessible"> - <object class="AtkObject" id="scalebutton-plus_button1-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Volume Up</property> - <property name="AtkObject::accessible-description" translatable="yes">Increases the volume</property> - </object> - </child> </object> </child> <child internal-child="minus_button"> <object class="GtkButton" id="scalebutton-minus_button1"> - <child internal-child="accessible"> - <object class="AtkObject" id="scalebutton-minus_button1-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Volume Down</property> - <property name="AtkObject::accessible-description" translatable="yes">Decreases the volume</property> - </object> - </child> </object> </child> </template> diff --git a/meson.build b/meson.build index e882dc20e3..43208bc669 100644 --- a/meson.build +++ b/meson.build @@ -29,7 +29,6 @@ endif glib_req = '>= @0@.@1@.@2@'.format(glib_major_req, glib_minor_req, glib_micro_req) pango_req = '>= 1.45.0' fribidi_req = '>= 0.19.7' -atk_req = '>= 2.15.1' cairo_req = '>= 1.14.0' gdk_pixbuf_req = '>= 2.30.0' introspection_req = '>= 1.39.0' @@ -367,8 +366,6 @@ pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req, fallback : ['gdk-pixbuf', 'gdkpixbuf_dep']) epoxy_dep = dependency('epoxy', version: epoxy_req, fallback: ['libepoxy', 'libepoxy_dep']) -atk_dep = dependency('atk', version: atk_req, - fallback : ['atk', 'libatk_dep']) harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false) xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled) graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req, @@ -376,7 +373,6 @@ graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req, iso_codes_dep = dependency('iso-codes', required: false) fontconfig_dep = [] # only used in x11 backend -atkbridge_dep = [] # only used in x11 backend if os_win32 platform_gio_dep = giowin32_dep @@ -474,8 +470,6 @@ cdata.set('HAVE_CAIRO_SCRIPT_INTERPRETER', cairo_csi_dep.found()) cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found()) cdata.set('HAVE_PANGOFT', pangoft_dep.found()) -atk_pkgs = ['atk'] - wayland_pkgs = [] if wayland_enabled wlclientdep = dependency('wayland-client', version: wayland_req) @@ -510,7 +504,6 @@ if x11_enabled xfixes_dep = dependency('xfixes', required: false) xcomposite_dep = dependency('xcomposite', required: false) fontconfig_dep = dependency('fontconfig') - atkbridge_dep = dependency('atk-bridge-2.0', version: atk_req) backend_immodules += ['xim'] @@ -529,8 +522,6 @@ if x11_enabled x11_pkgs += ['xcomposite'] endif - atk_pkgs += ['atk-bridge-2.0'] - cdata.set('HAVE_XCURSOR', xcursor_dep.found()) cdata.set('HAVE_XDAMAGE', xdamage_dep.found()) cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found()) @@ -765,8 +756,7 @@ pkgconf.set('GDK_PACKAGES', gdk_packages) pkgconf.set('GSK_PACKAGES', ' '.join([ 'graphene-gobject-1.0', graphene_req ])) pkgconf.set('GTK_PACKAGES', - ' '.join([ 'atk', atk_req, - 'gio-2.0', glib_req ])) + ' '.join([ 'gio-2.0', glib_req ])) # Requires.private pc_gdk_extra_libs += cairo_libs @@ -777,7 +767,7 @@ pkgconf.set('GDK_PRIVATE_PACKAGES', 'epoxy', epoxy_req ] + x11_pkgs + wayland_pkgs + cairo_backends)) pkgconf.set('GSK_PRIVATE_PACKAGES', '') # all already in GDK_PRIVATE_PACKAGES pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : [] -pkgconf.set('GTK_PRIVATE_PACKAGES', ' '.join(atk_pkgs + pangoft2_pkgs)) +pkgconf.set('GTK_PRIVATE_PACKAGES', ' '.join(pangoft2_pkgs)) pkgconf.set('GDK_EXTRA_LIBS', ' '.join(pc_gdk_extra_libs)) pkgconf.set('GSK_EXTRA_LIBS', '') diff --git a/subprojects/atk.wrap b/subprojects/atk.wrap deleted file mode 100644 index f6765c5bfa..0000000000 --- a/subprojects/atk.wrap +++ /dev/null @@ -1,5 +0,0 @@ -[wrap-git] -directory=atk -url=https://gitlab.gnome.org/GNOME/atk.git -push-url=ssh://git@gitlab.gnome.org:GNOME/atk.git -revision=master diff --git a/tests/testlist3.c b/tests/testlist3.c index db238f1829..bad61c1783 100644 --- a/tests/testlist3.c +++ b/tests/testlist3.c @@ -102,12 +102,6 @@ on_selected_children_changed (GtkListBox *self) } static void -a11y_selection_changed (AtkObject *obj) -{ - g_message ("Accessible selection changed"); -} - -static void selection_mode_changed (GtkComboBox *combo, gpointer data) { GtkListBox *list = data; @@ -152,7 +146,6 @@ main (int argc, char *argv[]) g_signal_connect (list, "row-activated", G_CALLBACK (on_row_activated), NULL); g_signal_connect (list, "selected-rows-changed", G_CALLBACK (on_selected_children_changed), NULL); - g_signal_connect (gtk_widget_get_accessible (list), "selection-changed", G_CALLBACK (a11y_selection_changed), NULL); sw = gtk_scrolled_window_new (); gtk_widget_set_hexpand (sw, TRUE); diff --git a/testsuite/a11y/README b/testsuite/a11y/README deleted file mode 100644 index 434b0d7d2d..0000000000 --- a/testsuite/a11y/README +++ /dev/null @@ -1,18 +0,0 @@ -accessibility-dump is a test runner that can do tests of static -accessibility information. Run it like this: - -./accessibility-dump [OPTIONS] TESTFILE [TESTFILES...] - -where TESTFILE is a GtkBuilder .ui file. accessibility-dump creates -a textual dump of the accessibility information for the created -widget hierarchy and compares it to a preexisting .txt file. - -To create an initial dump, you can use the --generate option with -a single .ui file. You should carefully inspect the output before -blessing it as the official .txt to compare against. - -To find out details about a failure, you can use the --verbose -option to see differences between expected and actual output. - -When run without any arguments, all the .ui files in the current -directory are tested. diff --git a/testsuite/a11y/about.txt b/testsuite/a11y/about.txt deleted file mode 100644 index b86b0fa9f1..0000000000 --- a/testsuite/a11y/about.txt +++ /dev/null @@ -1,434 +0,0 @@ -window1 - "dialog" - index: 0 - name: About FancyPants - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - ___object_1___ - "filler" - parent: window1 - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - ___object_1___ - "filler" - parent: ___object_1___ - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box - "filler" - parent: ___object_1___ - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - logo_image - "icon" - parent: box - index: 0 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: 0 x 0 - image description: (null) - name_label - "label" - parent: box - index: 1 - name: FancyPants - state: enabled focusable focused multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: FancyPants - character count: 10 - caret offset: 0 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: center - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - stack - "panel" - parent: box - index: 2 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - page_vbox - "filler" - parent: stack - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - version_label - "label" - parent: page_vbox - index: 0 - name: 0.99 - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: 0.99 - character count: 4 - caret offset: 0 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: center - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - comments_label - "label" - parent: page_vbox - index: 1 - name: comments - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: comments - character count: 8 - caret offset: 0 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: center - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - website_label - "label" - parent: page_vbox - index: 2 - name: Website - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Website - character count: 7 - caret offset: 0 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - <AtkHyperlink> - start index: 0 - end index: 7 - anchors: http://www.gtk.org - unnamed-GtkLabelAccessibleLinkImpl-0 - "link" - parent: website_label - state: enabled focusable focused multi-line sensitive showing visible - <AtkHyperlinkImpl> - <AtkHyperlink> - start index: 0 - end index: 7 - anchors: http://www.gtk.org - copyright_label - "label" - parent: page_vbox - index: 3 - name: no comments - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: no comments - character count: 11 - caret offset: 0 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: center - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - license_label - "label" - parent: page_vbox - index: 4 - name: This program comes with absolutely no warranty. -See the GNU General Public License, version 3 or later for details. - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: This program comes with absolutely no warranty. -See the GNU General Public License, version 3 or later for details. - character count: 115 - caret offset: 56 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: center - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - <AtkHyperlink> - start index: 56 - end index: 102 - anchors: https://www.gnu.org/licenses/gpl-3.0.html - unnamed-GtkLabelAccessibleLinkImpl-1 - "link" - parent: license_label - state: enabled focusable focused multi-line sensitive showing visible - <AtkHyperlinkImpl> - <AtkHyperlink> - start index: 56 - end index: 102 - anchors: https://www.gnu.org/licenses/gpl-3.0.html - action_box - "filler" - parent: ___object_1___ - index: 1 - state: enabled horizontal sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - action_area - "filler" - parent: action_box - index: 0 - state: enabled horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - headerbar1 - "panel" - parent: window1 - index: 1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - stack_switcher - "filler" - parent: headerbar1 - index: 0 - state: enabled focusable sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkToggleButtonAccessible-2 - "toggle button" - parent: stack_switcher - index: 0 - name: About - state: checked enabled focusable sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - unnamed-GtkToggleButtonAccessible-3 - "toggle button" - parent: stack_switcher - index: 1 - name: Credits - state: enabled focusable sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - unnamed-GtkToggleButtonAccessible-4 - "toggle button" - parent: stack_switcher - index: 2 - name: License - state: enabled focusable sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - unnamed-GtkToggleButtonAccessible-5 - "toggle button" - parent: stack_switcher - index: 3 - name: System - state: enabled focusable sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/about.ui b/testsuite/a11y/about.ui deleted file mode 100644 index baf99f360b..0000000000 --- a/testsuite/a11y/about.ui +++ /dev/null @@ -1,12 +0,0 @@ - -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkAboutDialog" id="window1"> - <property name="program-name">FancyPants</property> - <property name="version">0.99</property> - <property name="copyright">no comments</property> - <property name="comments">comments</property> - <property name="license-type">gpl-3-0</property> - <property name="website">http://www.gtk.org</property> - </object> -</interface> diff --git a/testsuite/a11y/accessibile-name.txt b/testsuite/a11y/accessibile-name.txt deleted file mode 100644 index 27d90762b0..0000000000 --- a/testsuite/a11y/accessibile-name.txt +++ /dev/null @@ -1,44 +0,0 @@ -window1 - "window" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gail - button1 - "push button" - parent: window1 - index: 0 - name: Accessible name - state: enabled focusable sensitive showing visible - toolkit: gail - text: Hello World! - character count: 12 - caret offset: 0 - default attributes: left-margin: 0 - right-margin: 0 - indent: 0 - invisible: false - editable: false - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - bg-full-height: 0 - scale: 1 - rise: 0 - underline: none - strikethrough: false - bg-stipple: false - fg-stipple: false - fg-color: <omitted> - bg-color: <omitted> - wrap-mode: word - justification: left - size: <omitted> - weight: <omitted> - family-name: <omitted> - stretch: <omitted> - variant: <omitted> - style: <omitted> - language: <omitted> - direction: <omitted> - image size: -1 x -1 - image description: (null) diff --git a/testsuite/a11y/accessibility-dump.c b/testsuite/a11y/accessibility-dump.c deleted file mode 100644 index 748cbcf106..0000000000 --- a/testsuite/a11y/accessibility-dump.c +++ /dev/null @@ -1,1003 +0,0 @@ -/* - * Copyright (C) 2011 Red Hat Inc. - * - * Author: - * Benjamin Otte <otte@redhat.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "config.h" - -#include <locale.h> -#include <string.h> -#include <glib/gstdio.h> -#include <gtk/gtk.h> - -#ifdef G_OS_WIN32 -# include <io.h> -#endif - -#define DEPTH_INCREMENT 2 - -static char * -get_test_file (const char *test_file, - const char *extension, - gboolean must_exist) -{ - GString *file = g_string_new (NULL); - - if (g_str_has_suffix (test_file, ".ui")) - g_string_append_len (file, test_file, strlen (test_file) - strlen (".ui")); - else - g_string_append (file, test_file); - - g_string_append (file, extension); - - if (must_exist && - !g_file_test (file->str, G_FILE_TEST_EXISTS)) - { - g_string_free (file, TRUE); - return NULL; - } - - return g_string_free (file, FALSE); -} - -static char * -diff_with_file (const char *file1, - char *text, - gssize len, - GError **error) -{ - const char *command[] = { "diff", "-u", file1, NULL, NULL }; - char *diff, *tmpfile; - int fd; - - diff = NULL; - - if (len < 0) - len = strlen (text); - - /* write the text buffer to a temporary file */ - fd = g_file_open_tmp (NULL, &tmpfile, error); - if (fd < 0) - return NULL; - - if (write (fd, text, len) != (int) len) - { - close (fd); - g_set_error (error, - G_FILE_ERROR, G_FILE_ERROR_FAILED, - "Could not write data to temporary file '%s'", tmpfile); - goto done; - } - close (fd); - command[3] = tmpfile; - - /* run diff command */ - g_spawn_sync (NULL, - (char **) command, - NULL, - G_SPAWN_SEARCH_PATH, - NULL, NULL, - &diff, - NULL, NULL, - error); - -done: - g_unlink (tmpfile); - g_free (tmpfile); - - return diff; -} - -static int unnamed_object_count; - -static void -setup_test (void) -{ - unnamed_object_count = 0; -} - -static const char * -get_name (AtkObject *accessible) -{ - char *name; - - name = g_object_get_data (G_OBJECT (accessible), "gtk-accessibility-dump-name"); - if (name) - return name; - - if (GTK_IS_ACCESSIBLE (accessible)) - { - GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - - name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (widget))); - } - - if (name == NULL && ATK_IS_TEXT (accessible)) - { - name = atk_text_get_text (ATK_TEXT (accessible), 0, -1); - } - - if (name == NULL) - { - /* Generate a unique, repeatable name */ - name = g_strdup_printf ("unnamed-%s-%d", G_OBJECT_TYPE_NAME (accessible), unnamed_object_count++); - } - - g_object_set_data_full (G_OBJECT (accessible), "gtk-accessibility-dump-name", name, g_free); - return name; -} - -static void -dump_relation (GString *string, - guint depth, - AtkRelation *relation) -{ - GPtrArray *targets; - const char *name; - guint i; - - targets = atk_relation_get_target (relation); - if (targets == NULL || targets->len == 0) - return; - - name = atk_relation_type_get_name (atk_relation_get_relation_type (relation)); - g_string_append_printf (string, "%*s%s: %s\n", depth, "", name, get_name (g_ptr_array_index (targets, 0))); - depth += strlen (name) + 2; - - for (i = 1; i < targets->len; i++) - { - g_string_append_printf (string, "%*s%s\n", depth, "", get_name (g_ptr_array_index (targets, i))); - } -} - -static void -dump_relation_set (GString *string, - guint depth, - AtkRelationSet *set) -{ - guint i; - - if (set == NULL) - return; - - for (i = 0; i < atk_relation_set_get_n_relations (set); i++) - { - AtkRelation *relation; - - relation = atk_relation_set_get_relation (set, i); - - dump_relation (string, depth, relation); - } - - g_object_unref (set); -} - -static void -dump_state_set (AtkObject *accessible, - GString *string, - guint depth, - AtkStateSet *set) -{ - guint i; - - if (set == NULL) - return; - - if (!atk_state_set_is_empty (set)) - { - g_string_append_printf (string, "%*sstate:", depth, ""); - for (i = 0; i < ATK_STATE_LAST_DEFINED; i++) - { - /* The toplevel active state depends on focus interaction with the WM, so lets ignore it */ - if (ATK_IS_WINDOW (accessible) && i == ATK_STATE_ACTIVE) - continue; - - if (atk_state_set_contains_state (set, i)) - g_string_append_printf (string, " %s", atk_state_type_get_name (i)); - } - g_string_append_c (string, '\n'); - } - - g_object_unref (set); -} - -static void -dump_attribute (GString *string, - guint depth, - AtkAttribute *attribute) -{ - g_string_append_printf (string, "%*s%s: %s\n", depth, "", attribute->name, attribute->value); -} - -static void -dump_attribute_set (GString *string, - guint depth, - AtkAttributeSet *set) -{ - GSList *l; - AtkAttribute *attribute; - - for (l = set; l; l = l->next) - { - attribute = l->data; - - dump_attribute (string, depth, attribute); - } -} - -static int -compare_attr (gconstpointer a, gconstpointer b) -{ - const AtkAttribute *aattr = a; - const AtkAttribute *battr = b; - - return strcmp (aattr->name, battr->name); -} - -static void -dump_text_attributes (GString *string, - int depth, - const char *name, - AtkAttributeSet *attributes) -{ - GSList *l; - AtkAttribute *attr; - const char *value; - - if (attributes == NULL) - return; - - attributes = g_slist_sort (attributes, compare_attr); - - for (l = attributes; l; l = l->next) - { - attr = l->data; - /* don't dump values that depend on the environment or too - * closely on the exact theme pixels. - */ - if (strcmp (attr->name, "family-name") == 0 || - strcmp (attr->name, "size") == 0 || - strcmp (attr->name, "weight") == 0 || - strcmp (attr->name, "stretch") == 0 || - strcmp (attr->name, "variant") == 0 || - strcmp (attr->name, "style") == 0 || - strcmp (attr->name, "language") == 0 || - strcmp (attr->name, "fg-color") == 0 || - strcmp (attr->name, "bg-color") == 0 || - strcmp (attr->name, "direction") == 0) - value = "<omitted>"; - else - value = attr->value; - - if (name) - { - /* first time this loop is run */ - g_string_append_printf (string, "%*s%s: %s: %s\n", depth, "", name, attr->name, value); - depth += strlen (name) + 2; - name = NULL; - } - else - { - /* every other time */ - g_string_append_printf (string, "%*s%s: %s\n", depth, "", attr->name, value); - } - } - - atk_attribute_set_free (attributes); -} - -static const char * -layer_name (AtkLayer layer) -{ - GEnumClass *class; - GEnumValue *value; - - class = g_type_class_ref (atk_layer_get_type ()); - value = g_enum_get_value (class, layer); - g_type_class_unref (class); - - return value->value_nick; -} - -static void -dump_atk_component (AtkComponent *atk_component, - guint depth, - GString *string) -{ - AtkLayer layer; - - g_string_append_printf (string, "%*s<AtkComponent>\n", depth, ""); - - layer = atk_component_get_layer (atk_component); - g_string_append_printf (string, "%*slayer: %s\n", depth, "", layer_name (layer)); - - g_string_append_printf (string, "%*salpha: %g\n", depth, "", atk_component_get_alpha (atk_component)); -} - -static void -dump_atk_text (AtkText *atk_text, - guint depth, - GString *string) -{ - char *text; - int i, start, end; - - g_string_append_printf (string, "%*s<AtkText>\n", depth, ""); - - text = atk_text_get_text (atk_text, 0, -1); - g_string_append_printf (string, "%*stext: %s\n", depth, "", text); - g_free (text); - - g_string_append_printf (string, "%*scharacter count: %d\n", depth, "", atk_text_get_character_count (atk_text)); - - g_string_append_printf (string, "%*scaret offset: %d\n", depth, "", atk_text_get_caret_offset (atk_text)); - - for (i = 0; i < atk_text_get_n_selections (atk_text); i++) - { - text = atk_text_get_selection (atk_text, i, &start, &end); - if (text) - g_string_append_printf (string, "%*sselection %d: (%d, %d) %s\n", depth, "", i, start, end, text); - g_free (text); - } - - dump_text_attributes (string, depth, "default attributes", atk_text_get_default_attributes (atk_text)); -} - -static void -dump_atk_image (AtkImage *atk_image, - guint depth, - GString *string) -{ - int width, height; - - g_string_append_printf (string, "%*s<AtkImage>\n", depth, ""); - - atk_image_get_image_size (atk_image, &width, &height); - g_string_append_printf (string, "%*simage size: %d x %d\n", depth, "", width, height); - - g_string_append_printf (string, "%*simage description: %s\n", depth, "", atk_image_get_image_description (atk_image)); -} - -static void -dump_atk_action (AtkAction *atk_action, - guint depth, - GString *string) -{ - int i; - - g_string_append_printf (string, "%*s<AtkAction>\n", depth, ""); - - for (i = 0; i < atk_action_get_n_actions (atk_action); i++) - { - if (atk_action_get_name (atk_action, i)) - g_string_append_printf (string, "%*saction %d name: %s\n", depth, "", i, atk_action_get_name (atk_action, i)); - if (atk_action_get_description (atk_action, i)) - g_string_append_printf (string, "%*saction %d description: %s\n", depth, "", i, atk_action_get_description (atk_action, i)); - if (atk_action_get_keybinding (atk_action, i)) - g_string_append_printf (string, "%*saction %d keybinding: %s\n", depth, "", i, atk_action_get_keybinding (atk_action, i)); - } -} - -static void -dump_atk_selection (AtkSelection *atk_selection, - guint depth, - GString *string) -{ - guint n_selections, n_counted_selections; - int i; - - g_string_append_printf (string, "%*s<AtkSelection>\n", depth, ""); - - n_selections = atk_selection_get_selection_count (atk_selection); - - n_counted_selections = 0; - for (i = 0; i < atk_object_get_n_accessible_children (ATK_OBJECT (atk_selection)); i++) - { - if (atk_selection_is_child_selected (atk_selection, i)) - { - AtkObject *object = atk_object_ref_accessible_child (ATK_OBJECT (atk_selection), i); - - g_assert (object); - - if (n_counted_selections == 0) - { - g_string_append_printf (string, "%*sselected children: %s\n", depth, "", get_name (object)); - depth += strlen ("selected children: "); - } - else - g_string_append_printf (string, "%*s%s\n", depth, "", get_name (object)); - n_counted_selections++; - } - } - - g_assert_cmpint (n_selections, ==, n_counted_selections); - g_assert_cmpint (n_selections, ==, atk_selection_get_selection_count (atk_selection)); -} - -static void -dump_atk_value (AtkValue *atk_value, - guint depth, - GString *string) -{ - AtkRange *range; - double value; - char *text; - - value = 0.0; - text = NULL; - - atk_value_get_value_and_text (atk_value, &value, &text); - range = atk_value_get_range (atk_value); - - g_string_append_printf (string, "%*s<AtkValue>\n", depth, ""); - - if (range) - { - g_string_append_printf (string, "%*sminimum value: %f\n", depth, "", atk_range_get_lower_limit (range)); - - g_string_append_printf (string, "%*smaximum value: %f\n", depth, "", atk_range_get_upper_limit (range)); - - atk_range_free (range); - } - - if (text) - { - g_string_append_printf (string, "%*scurrent value: %f %s\n", depth, "", value, text); - g_free (text); - } - else - g_string_append_printf (string, "%*scurrent value: %f\n", depth, "", value); - - /* Don't dump minimum increment; it changes too much in response to - * theme changes. - * https://bugzilla.gnome.org/show_bug.cgi?id=704747 - */ -} - -static void -dump_atk_hyperlink (AtkHyperlink *link, - guint depth, - GString *string) -{ - int i; - - g_string_append_printf (string, "%*s<AtkHyperlink>\n", depth, ""); - g_string_append_printf (string, "%*sstart index: %d\n", depth, "", atk_hyperlink_get_start_index (link)); - g_string_append_printf (string, "%*send index: %d\n", depth, "", atk_hyperlink_get_end_index (link)); - g_string_append_printf (string, "%*sanchors:", depth, ""); - - for (i = 0; i < atk_hyperlink_get_n_anchors (link); i++) - { - char *uri; - - uri = atk_hyperlink_get_uri (link, i); - g_string_append_printf (string, " %s", uri); - g_free (uri); - } - - g_string_append_c (string, '\n'); -} - -static void -dump_atk_hyperlink_impl (AtkHyperlinkImpl *impl, - guint depth, - GString *string) -{ - AtkHyperlink *link; - - g_string_append_printf (string, "%*s<AtkHyperlinkImpl>\n", depth, ""); - - link = atk_hyperlink_impl_get_hyperlink (impl); - dump_atk_hyperlink (link, depth + DEPTH_INCREMENT, string); - g_object_unref (link); -} - -static void -dump_atk_hypertext (AtkHypertext *hypertext, - guint depth, - GString *string) -{ - int i; - AtkHyperlink *link; - - g_string_append_printf (string, "%*s<AtkHypertext>\n", depth, ""); - - for (i = 0; i < atk_hypertext_get_n_links (hypertext); i++) - { - link = atk_hypertext_get_link (hypertext, i); - dump_atk_hyperlink (link, depth + DEPTH_INCREMENT, string); - } -} - -static void -dump_atk_streamable_content (AtkStreamableContent *content, - guint depth, - GString *string) -{ - int i; - - g_string_append_printf (string, "%*s<AtkStreamableContent>\n", depth, ""); - - g_string_append_printf (string, "%*smime types:", depth, ""); - for (i = 0; i < atk_streamable_content_get_n_mime_types (content); i++) - g_string_append_printf (string, " %s", atk_streamable_content_get_mime_type (content, i)); - g_string_append_c (string, '\n'); -} - -static void -dump_atk_table (AtkTable *table, - guint depth, - GString *string) -{ - int *selected; - int n_selected; - int i, j; - AtkObject *obj; - const char *desc; - - g_string_append_printf (string, "%*s<AtkTable>\n", depth, ""); - - obj = atk_table_get_summary (table); - if (obj) - g_string_append_printf (string, "%*ssummary: %s\n", depth, "", get_name (obj)); - - obj = atk_table_get_caption (table); - if (obj) - g_string_append_printf (string, "%*scaption: %s\n", depth, "", get_name (obj)); - - g_string_append_printf (string, "%*srows: %d\n", depth, "", atk_table_get_n_rows (table)); - g_string_append_printf (string, "%*scolumns: %d\n", depth, "", atk_table_get_n_columns (table)); - - selected = NULL; - n_selected = atk_table_get_selected_rows (table, &selected); - if (n_selected > 0) - { - g_string_append_printf (string, "%*sselected rows:", depth, ""); - for (i = 0; i < n_selected; i++) - g_string_append_printf (string, " %d", selected[i]); - g_string_append_c (string, '\n'); - } - g_free (selected); - - selected = NULL; - n_selected = atk_table_get_selected_columns (table, &selected); - if (n_selected > 0) - { - g_string_append_printf (string, "%*sselected columns:", depth, ""); - for (i = 0; i < n_selected; i++) - g_string_append_printf (string, " %d", selected[i]); - g_string_append_c (string, '\n'); - } - g_free (selected); - - - for (i = 0; i < atk_table_get_n_columns (table); i++) - { - desc = atk_table_get_column_description (table, i); - if (desc) - g_string_append_printf (string, "%*scolumn %d description: %s\n", depth, "", i, desc); - obj = atk_table_get_column_header (table, i); - if (obj) - g_string_append_printf (string, "%*scolumn %d header: %s\n", depth, "", i, get_name (obj)); - } - - for (i = 0; i < atk_table_get_n_rows (table); i++) - { - desc = atk_table_get_row_description (table, i); - if (desc) - g_string_append_printf (string, "%*srow %d description: %s\n", depth, "", i, desc); - obj = atk_table_get_row_header (table, i); - if (obj) - g_string_append_printf (string, "%*srow %d header: %s\n", depth, "", i, get_name (obj)); - } - - g_string_append_printf (string, "%*stable indexes:\n", depth, ""); - for (i = 0; i < atk_table_get_n_rows (table); i++) - { - g_string_append_printf (string, "%*s", depth + DEPTH_INCREMENT, ""); - for (j = 0; j < atk_table_get_n_columns (table); j++) - { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - int id = atk_table_get_index_at (table, i, j); - - obj = atk_object_ref_accessible_child (ATK_OBJECT (table), id); - if (j > 0) - g_string_append (string, " "); - - g_string_append_printf (string, "%s%s%s", - atk_table_get_row_at_index (table, id) == i ? "✓" : "⚠", - atk_table_get_column_at_index (table, id) == j ? "✓" : "⚠", - get_name (obj)); -G_GNUC_END_IGNORE_DEPRECATIONS - } - g_string_append (string, "\n"); - } -} - -static void -dump_atk_table_cell (AtkTableCell *table_cell, - guint depth, - GString *string) -{ - int i; - AtkObject *obj; - GPtrArray *cells; - int row = -1, column = -1; - - g_string_append_printf (string, "%*s<AtkTableCell>\n", depth, ""); - - obj = atk_table_cell_get_table (table_cell); - if (obj) - g_string_append_printf (string, "%*stable: %s\n", depth, "", get_name (obj)); - - cells = atk_table_cell_get_column_header_cells (table_cell); - if (cells) - { - for (i = 0; i < cells->len; i++) - { - obj = g_ptr_array_index (cells, i); - if (obj) - g_string_append_printf (string, "%*scolumn-header[%d]: %s\n", depth, "", i, get_name (obj)); - } - g_ptr_array_free (cells, TRUE); - } - - cells = atk_table_cell_get_row_header_cells (table_cell); - if (cells) - { - for (i = 0; i < cells->len; i++) - { - obj = g_ptr_array_index (cells, i); - if (obj) - g_string_append_printf (string, "%*srow-header[%d]: %s\n", depth, "", i, get_name (obj)); - } - g_ptr_array_free (cells, TRUE); - } - - g_string_append_printf (string, "%*scolumn-span: %d\n", depth, "", atk_table_cell_get_column_span (table_cell)); - g_string_append_printf (string, "%*srow-span: %d\n", depth, "", atk_table_cell_get_row_span (table_cell)); - if (atk_table_cell_get_position (table_cell, &row, &column)) - { - g_string_append_printf (string, "%*sposition: %d %d\n", depth, "", row, column); - } -} - -static void -dump_accessible (AtkObject *accessible, - guint depth, - GString *string) -{ - guint i; - - g_string_append_printf (string, "%*s%s\n", depth, "", get_name (accessible)); - depth += DEPTH_INCREMENT; - - g_string_append_printf (string, "%*s\"%s\"\n", depth, "", atk_role_get_name (atk_object_get_role (accessible))); - if (GTK_IS_ACCESSIBLE (atk_object_get_parent (accessible))) - g_string_append_printf (string, "%*sparent: %s\n", depth, "", get_name (atk_object_get_parent (accessible))); - if (atk_object_get_index_in_parent (accessible) != -1) - g_string_append_printf (string, "%*sindex: %d\n", depth, "", atk_object_get_index_in_parent (accessible)); - if (atk_object_get_name (accessible)) - g_string_append_printf (string, "%*sname: %s\n", depth, "", atk_object_get_name (accessible)); - if (atk_object_get_description (accessible)) - g_string_append_printf (string, "%*sdescription: %s\n", depth, "", atk_object_get_description (accessible)); - dump_relation_set (string, depth, atk_object_ref_relation_set (accessible)); - dump_state_set (accessible, string, depth, atk_object_ref_state_set (accessible)); - dump_attribute_set (string, depth, atk_object_get_attributes (accessible)); - - if (ATK_IS_COMPONENT (accessible)) - dump_atk_component (ATK_COMPONENT (accessible), depth, string); - - if (ATK_IS_TEXT (accessible)) - dump_atk_text (ATK_TEXT (accessible), depth, string); - - if (ATK_IS_IMAGE (accessible)) - dump_atk_image (ATK_IMAGE (accessible), depth, string); - - if (ATK_IS_ACTION (accessible)) - dump_atk_action (ATK_ACTION (accessible), depth, string); - - if (ATK_IS_SELECTION (accessible)) - dump_atk_selection (ATK_SELECTION (accessible), depth, string); - - if (ATK_IS_VALUE (accessible)) - dump_atk_value (ATK_VALUE (accessible), depth, string); - - if (ATK_IS_HYPERLINK_IMPL (accessible)) - dump_atk_hyperlink_impl (ATK_HYPERLINK_IMPL (accessible), depth, string); - - if (ATK_IS_HYPERTEXT (accessible)) - dump_atk_hypertext (ATK_HYPERTEXT (accessible), depth, string); - - if (ATK_IS_STREAMABLE_CONTENT (accessible)) - dump_atk_streamable_content (ATK_STREAMABLE_CONTENT (accessible), depth, string); - - if (ATK_IS_TABLE (accessible)) - dump_atk_table (ATK_TABLE (accessible), depth, string); - - if (ATK_IS_TABLE_CELL (accessible)) - dump_atk_table_cell (ATK_TABLE_CELL (accessible), depth, string); - - for (i = 0; i < atk_object_get_n_accessible_children (accessible); i++) - { - AtkObject *child = atk_object_ref_accessible_child (accessible, i); - dump_accessible (child, depth, string); - g_object_unref (child); - } -} - -static GtkWidget * -builder_get_toplevel (GtkBuilder *builder) -{ - GSList *list, *walk; - GtkWidget *window = NULL; - - list = gtk_builder_get_objects (builder); - for (walk = list; walk; walk = walk->next) - { - if (GTK_IS_WINDOW (walk->data) && - gtk_widget_get_parent (walk->data) == NULL) - { - window = walk->data; - break; - } - } - - g_slist_free (list); - - return window; -} - -static void -dump_ui_file (const char *ui_file, - GString *string) -{ - GtkWidget *window; - GtkBuilder *builder; - GError *error = NULL; - - builder = gtk_builder_new (); - gtk_builder_add_from_file (builder, ui_file, &error); - g_assert_no_error (error); - window = builder_get_toplevel (builder); - g_object_unref (builder); - g_assert (window); - - gtk_widget_show (window); - - dump_accessible (gtk_widget_get_accessible (window), 0, string); - gtk_window_destroy (GTK_WINDOW (window)); -} - -static void -dump_to_stdout (GFile *file) -{ - char *ui_file; - GString *dump; - - ui_file = g_file_get_path (file); - dump = g_string_new (""); - - dump_ui_file (ui_file, dump); - g_print ("%s", dump->str); - - g_string_free (dump, TRUE); - g_free (ui_file); -} - -static void -test_ui_file (GFile *file) -{ - char *ui_file, *a11y_file; - GString *dump; - GError *error = NULL; - - ui_file = g_file_get_path (file); - a11y_file = get_test_file (ui_file, ".txt", TRUE); - dump = g_string_new (""); - - dump_ui_file (ui_file, dump); - - if (a11y_file) - { - char *diff = diff_with_file (a11y_file, dump->str, dump->len, &error); - g_assert_no_error (error); - - if (diff && diff[0]) - { - g_printerr ("Contents don't match expected contents:\n%s", diff); - g_test_fail (); - g_free (diff); - } - } - else if (dump->str[0]) - { - g_test_message ("Expected a reference file:\n%s", dump->str); - g_test_fail (); - } - - g_string_free (dump, TRUE); - g_free (a11y_file); - g_free (ui_file); -} - -static void -add_test_for_file (GFile *file) -{ - g_test_add_vtable (g_file_get_path (file), - 0, - g_object_ref (file), - (GTestFixtureFunc) setup_test, - (GTestFixtureFunc) test_ui_file, - (GTestFixtureFunc) g_object_unref); -} - -static int -compare_files (gconstpointer a, gconstpointer b) -{ - GFile *file1 = G_FILE (a); - GFile *file2 = G_FILE (b); - char *path1, *path2; - int result; - - path1 = g_file_get_path (file1); - path2 = g_file_get_path (file2); - - result = strcmp (path1, path2); - - g_free (path1); - g_free (path2); - - return result; -} - -static void -add_tests_for_files_in_directory (GFile *dir) -{ - GFileEnumerator *enumerator; - GFileInfo *info; - GList *files; - GError *error = NULL; - - enumerator = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &error); - g_assert_no_error (error); - files = NULL; - - while ((info = g_file_enumerator_next_file (enumerator, NULL, &error))) - { - const char *filename; - - filename = g_file_info_get_name (info); - - if (!g_str_has_suffix (filename, ".ui")) - { - g_object_unref (info); - continue; - } - - files = g_list_prepend (files, g_file_get_child (dir, filename)); - - g_object_unref (info); - } - - g_assert_no_error (error); - g_object_unref (enumerator); - - files = g_list_sort (files, compare_files); - g_list_foreach (files, (GFunc) add_test_for_file, NULL); - g_list_free_full (files, g_object_unref); -} - -static char *arg_base_dir = NULL; - -static const GOptionEntry test_args[] = { - { "directory", 'd', 0, G_OPTION_ARG_FILENAME, &arg_base_dir, - "Directory to run tests from", "DIR" }, - { NULL } -}; - -static gboolean -parse_command_line (int *argc, char ***argv) -{ - GError *error = NULL; - GOptionContext *context; - - context = g_option_context_new ("- run GTK accessibility tests"); - g_option_context_add_main_entries (context, test_args, NULL); - g_option_context_set_ignore_unknown_options (context, TRUE); - - if (!g_option_context_parse (context, argc, argv, &error)) - { - g_print ("option parsing failed: %s\n", error->message); - return FALSE; - } - - return TRUE; -} - -static void -fix_settings (void) -{ - /* Some settings can affect the output of the accessibility tests, - * so we take some steps to isolate us from the ambient environment. - */ - - g_object_set (gtk_settings_get_default (), - "gtk-dialogs-use-header", TRUE, - NULL); -} - -int -main (int argc, char **argv) -{ - if (!parse_command_line (&argc, &argv)) - return 1; - - fix_settings (); - - if (argc == 3 && strcmp (argv[1], "--generate") == 0) - { - GFile *file = g_file_new_for_commandline_arg (argv[2]); - - gtk_init (); - - dump_to_stdout (file); - g_object_unref (file); - - return 0; - } - - gtk_test_init (&argc, &argv); - - /* gtk_test_init does not call setlocale(), so do it ourselves, - * since running in the C locale breaks some our fancy - * utf8 output. - */ - setlocale (LC_ALL, "en_US.utf8"); - - if (argc < 2) - { - const char *basedir; - GFile *dir; - - if (arg_base_dir) - basedir = arg_base_dir; - else - basedir = g_test_get_dir (G_TEST_DIST); - dir = g_file_new_for_path (basedir); - add_tests_for_files_in_directory (dir); - - g_object_unref (dir); - } - else - { - guint i; - - for (i = 1; i < argc; i++) - { - GFile *file = g_file_new_for_commandline_arg (argv[i]); - - add_test_for_file (file); - - g_object_unref (file); - } - } - - return g_test_run (); -} - diff --git a/testsuite/a11y/accessible-name.txt b/testsuite/a11y/accessible-name.txt deleted file mode 100644 index d1a78b61c4..0000000000 --- a/testsuite/a11y/accessible-name.txt +++ /dev/null @@ -1,32 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "push button" - parent: window1 - index: 0 - name: Accessible name - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/accessible-name.ui b/testsuite/a11y/accessible-name.ui deleted file mode 100644 index a71bf44cc8..0000000000 --- a/testsuite/a11y/accessible-name.ui +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkButton" id="button1"> - <property name="label" translatable="yes">Hello World!</property> - <property name="visible">True</property> - <property name="receives_default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="button1-accessible"> - <property name="accessible-name" translatable="yes">Accessible name</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/actionbar.txt b/testsuite/a11y/actionbar.txt deleted file mode 100644 index 0fa7c3a717..0000000000 --- a/testsuite/a11y/actionbar.txt +++ /dev/null @@ -1,105 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - actionbar - "panel" - parent: window1 - index: 0 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "push button" - parent: unnamed-GtkContainerAccessible-1 - index: 0 - name: Start 1 - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button2 - "push button" - parent: unnamed-GtkContainerAccessible-1 - index: 1 - name: Start 2 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button5 - "push button" - parent: unnamed-GtkWidgetAccessible-2 - index: 1 - name: Center - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button4 - "push button" - parent: unnamed-GtkContainerAccessible-3 - index: 0 - name: End 2 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button3 - "push button" - parent: unnamed-GtkContainerAccessible-3 - index: 1 - name: End 1 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/actionbar.ui b/testsuite/a11y/actionbar.ui deleted file mode 100644 index fdf23e3b3d..0000000000 --- a/testsuite/a11y/actionbar.ui +++ /dev/null @@ -1,33 +0,0 @@ -<interface> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkActionBar" id="actionbar"> - <child type="start"> - <object class="GtkButton" id="button1"> - <property name="label">Start 1</property> - </object> - </child> - <child type="start"> - <object class="GtkButton" id="button2"> - <property name="label">Start 2</property> - </object> - </child> - <child type="end"> - <object class="GtkButton" id="button3"> - <property name="label">End 1</property> - </object> - </child> - <child type="end"> - <object class="GtkButton" id="button4"> - <property name="label">End 2</property> - </object> - </child> - <child type="center"> - <object class="GtkButton" id="button5"> - <property name="label">Center</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/assistant.txt b/testsuite/a11y/assistant.txt deleted file mode 100644 index 5daab74117..0000000000 --- a/testsuite/a11y/assistant.txt +++ /dev/null @@ -1,161 +0,0 @@ -window1 - "panel" - index: 0 - name: Page 1 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "push button" - parent: content - index: 0 - name: Page 1 - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button2 - "push button" - parent: content - index: 1 - name: Page 2 - state: enabled focusable sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action_area - "filler" - parent: content_box - index: 1 - state: enabled horizontal sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - headerbar - "panel" - parent: window1 - index: 1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - cancel - "push button" - parent: unnamed-GtkContainerAccessible-0 - index: 0 - name: Cancel - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action 0 keybinding: <Alt>c - back - "push button" - parent: unnamed-GtkContainerAccessible-0 - index: 1 - name: Back - state: enabled focusable sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action 0 keybinding: <Alt>b - apply - "push button" - parent: unnamed-GtkContainerAccessible-1 - index: 0 - name: Apply - state: enabled focusable sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action 0 keybinding: <Alt>a - forward - "push button" - parent: unnamed-GtkContainerAccessible-1 - index: 1 - name: Next - state: focusable showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action 0 keybinding: <Alt>n - last - "push button" - parent: unnamed-GtkContainerAccessible-1 - index: 2 - name: Finish - state: focusable - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action 0 keybinding: <Alt>f - close - "push button" - parent: unnamed-GtkContainerAccessible-1 - index: 3 - name: Close - state: enabled focusable sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action 0 keybinding: <Alt>c diff --git a/testsuite/a11y/assistant.ui b/testsuite/a11y/assistant.ui deleted file mode 100644 index b7be54e2bd..0000000000 --- a/testsuite/a11y/assistant.ui +++ /dev/null @@ -1,24 +0,0 @@ -<interface> - <object class="GtkAssistant" id="window1"> - <child> - <object class="GtkAssistantPage"> - <property name="title" translatable="yes">Page 1</property> - <property name="child"> - <object class="GtkButton" id="button1"> - <property name="label" translatable="yes">Button 1</property> - </object> - </property> - </object> - </child> - <child> - <object class="GtkAssistantPage"> - <property name="title" translatable="yes">Page 2</property> - <property name="child"> - <object class="GtkButton" id="button2"> - <property name="label" translatable="yes">Button 2</property> - </object> - </property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/buttons.txt b/testsuite/a11y/buttons.txt deleted file mode 100644 index c548386098..0000000000 --- a/testsuite/a11y/buttons.txt +++ /dev/null @@ -1,164 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - grid1 - "panel" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "toggle button" - parent: grid1 - index: 0 - name: Hello World! - state: checked enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button2 - "check box" - parent: grid1 - index: 1 - name: Hello World! - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button3 - "radio button" - parent: grid1 - index: 2 - name: Hello World! - member-of: button4 - button3 - state: checked enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button4 - "radio button" - parent: grid1 - index: 3 - name: Hello World! - member-of: button4 - button3 - state: checked enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button5 - "toggle button" - parent: grid1 - index: 4 - state: checked enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: toggle - action 0 description: Toggles the switch - button6 - "toggle button" - parent: grid1 - index: 5 - name: Test switch - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: toggle - action 0 description: Toggles the switch - button7 - "push button" - parent: grid1 - index: 6 - name: Text Button - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button8 - "push button" - parent: grid1 - index: 7 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button9 - "push button" - parent: grid1 - index: 8 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/buttons.ui b/testsuite/a11y/buttons.ui deleted file mode 100644 index 9450cf6e6e..0000000000 --- a/testsuite/a11y/buttons.ui +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkGrid" id="grid1"> - <child> - <object class="GtkToggleButton" id="button1"> - <property name="label" translatable="yes">Hello World!</property> - <property name="active">1</property> - <property name="receives_default">1</property> - <layout> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkCheckButton" id="button2"> - <property name="label" translatable="yes">Hello World!</property> - <property name="receives_default">1</property> - <layout> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkRadioButton" id="button3"> - <property name="label" translatable="yes">Hello World!</property> - <property name="receives_default">1</property> - <layout> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkRadioButton" id="button4"> - <property name="label" translatable="yes">Hello World!</property> - <property name="active">1</property> - <property name="group">button3</property> - <property name="receives_default">1</property> - <layout> - <property name="left_attach">3</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkSwitch" id="button5"> - <property name="active">1</property> - <property name="receives_default">1</property> - <layout> - <property name="left_attach">4</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkSwitch" id="button6"> - <property name="receives_default">1</property> - <child internal-child="accessible"> - <object class="AtkObject" id="button6-accessible"> - <property name="accessible-name">Test switch</property> - </object> - </child> - <layout> - <property name="left_attach">5</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkButton" id="button7"> - <property name="receives_default">1</property> - <property name="label">Text Button</property> - <layout> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </layout> - </object> - </child> - <child> - <object class="GtkButton" id="button8"> - <property name="receives_default">1</property> - <property name="halign">center</property> - <property name="valign">center</property> - <layout> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </layout> - </object> - </child> - <child> - <object class="GtkButton" id="button9"> - <property name="receives_default">1</property> - <property name="halign">center</property> - <property name="valign">center</property> - <layout> - <property name="left_attach">2</property> - <property name="top_attach">1</property> - </layout> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/calendar.txt b/testsuite/a11y/calendar.txt deleted file mode 100644 index 6c7dca3d2e..0000000000 --- a/testsuite/a11y/calendar.txt +++ /dev/null @@ -1,25 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - calendar1 - "calendar" - parent: window1 - index: 0 - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 diff --git a/testsuite/a11y/calendar.ui b/testsuite/a11y/calendar.ui deleted file mode 100644 index 9a0da55b6f..0000000000 --- a/testsuite/a11y/calendar.ui +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkCalendar" id="calendar1"> - <property name="visible">True</property> - <property name="day">1</property> - <property name="month">2</property> - <property name="year">1970</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/children.c b/testsuite/a11y/children.c deleted file mode 100644 index 25315c990a..0000000000 --- a/testsuite/a11y/children.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (C) 2011 Red Hat Inc. - * - * Author: - * Matthias Clasen <mclasen@redhat.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#define GDK_DISABLE_DEPRECATION_WARNINGS -#undef GTK_DISABLE_DEPRECATED - -#include <gtk/gtk.h> -#include <string.h> - -typedef struct -{ - GtkWidget *widget; - gpointer child[3]; -} STATE; - -static void -test_scrolled_window_child_count (void) -{ - GtkWidget *sw; - AtkObject *accessible; - - sw = gtk_scrolled_window_new (); - g_object_ref_sink (sw); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS); - gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), gtk_label_new ("Bla")); - - accessible = gtk_widget_get_accessible (sw); - g_assert_cmpint (atk_object_get_n_accessible_children (accessible), ==, 3); - - g_object_unref (sw); -} - -typedef struct { - int count; - int index; - int n_children; - gpointer parent; -} SignalData; - -static void -children_changed (AtkObject *accessible, - guint index, - gpointer child, - SignalData *data) -{ - data->count++; - data->index = index; - data->n_children = atk_object_get_n_accessible_children (accessible); -} - -static void -remove_child (STATE *state, - int i) -{ - GtkWidget *child; - - if (GTK_IS_ENTRY (state->widget)) - { - switch (i) - { - case 0: - gtk_entry_set_icon_from_gicon (GTK_ENTRY (state->widget), - GTK_ENTRY_ICON_PRIMARY, - NULL); - return; - case 1: - gtk_entry_set_icon_from_gicon (GTK_ENTRY (state->widget), - GTK_ENTRY_ICON_SECONDARY, - NULL); - return; - default: - return; - } - } - - child = state->child [i]; - if (GTK_IS_SCROLLED_WINDOW (state->widget)) - { - if (gtk_widget_get_parent (child) != state->widget) - child = gtk_widget_get_parent (child); - } - - gtk_box_remove (GTK_BOX (state->widget), child); -} - -static void -parent_notify (AtkObject *obj, GParamSpec *pspec, SignalData *data) -{ - data->count++; - data->parent = atk_object_get_parent (obj); -} - -static gboolean -do_create_child (STATE *state, int i) -{ - if (GTK_IS_ENTRY (state->widget)) - { - switch (i) - { - case 0: - gtk_entry_set_icon_from_icon_name (GTK_ENTRY (state->widget), - GTK_ENTRY_ICON_PRIMARY, - "dialog-warning-symbolic"); - return TRUE; - case 1: - gtk_entry_set_icon_from_icon_name (GTK_ENTRY (state->widget), - GTK_ENTRY_ICON_SECONDARY, - "edit-clear"); - return TRUE; - default: - return FALSE; - } - } - - state->child[i] = gtk_label_new ("bla"); - return TRUE; -} - -static void -test_add_remove (GtkWidget *widget) -{ - AtkObject *accessible; - AtkObject *child_accessible; - SignalData add_data; - SignalData remove_data; - SignalData parent_data[3] = { { 0, }, }; - STATE state; - int i, j; - int step_children; - - state.widget = widget; - accessible = gtk_widget_get_accessible (widget); - - add_data.count = 0; - remove_data.count = 0; - g_signal_connect (accessible, "children_changed::add", - G_CALLBACK (children_changed), &add_data); - g_signal_connect (accessible, "children_changed::remove", - G_CALLBACK (children_changed), &remove_data); - - step_children = atk_object_get_n_accessible_children (accessible); - - for (i = 0; i < 3; i++) - { - if (!do_create_child (&state, i)) - break; - if (!GTK_IS_ENTRY (widget)) - { - parent_data[i].count = 0; - child_accessible = gtk_widget_get_accessible (state.child[i]); - g_signal_connect (child_accessible, "notify::accessible-parent", - G_CALLBACK (parent_notify), &(parent_data[i])); - gtk_box_append (GTK_BOX (widget), state.child[i]); - } - else - child_accessible = atk_object_ref_accessible_child (accessible, i); - - g_assert_cmpint (add_data.count, ==, i + 1); - g_assert_cmpint (add_data.n_children, ==, step_children + i + 1); - g_assert_cmpint (remove_data.count, ==, 0); - if (!GTK_IS_ENTRY (widget)) - g_assert_cmpint (parent_data[i].count, ==, 1); - if (GTK_IS_SCROLLED_WINDOW (widget) || - GTK_IS_NOTEBOOK (widget)) - g_assert (atk_object_get_parent (ATK_OBJECT (parent_data[i].parent)) == accessible); - else if (GTK_IS_ENTRY (widget)) - g_assert (atk_object_get_parent (child_accessible) == accessible); - else - g_assert (parent_data[i].parent == accessible); - - if (GTK_IS_ENTRY (widget)) - g_object_unref (child_accessible); - } - for (j = 0 ; j < i; j++) - { - remove_child (&state, j); - g_assert_cmpint (add_data.count, ==, i); - g_assert_cmpint (remove_data.count, ==, j + 1); - g_assert_cmpint (remove_data.n_children, ==, step_children + i - j - 1); - if (parent_data[j].count == 2) - g_assert (parent_data[j].parent == NULL); - else if (!GTK_IS_ENTRY (widget)) - { - AtkStateSet *set; - set = atk_object_ref_state_set (ATK_OBJECT (parent_data[j].parent)); - g_assert (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT)); - g_object_unref (set); - } - } - - g_signal_handlers_disconnect_by_func (accessible, G_CALLBACK (children_changed), &add_data); - g_signal_handlers_disconnect_by_func (accessible, G_CALLBACK (children_changed), &remove_data); -} - -static void -add_child_test (const char *prefix, - GTestFixtureFunc test_func, - GtkWidget *widget) -{ - char *path; - - path = g_strdup_printf ("%s/%s", prefix, G_OBJECT_TYPE_NAME (widget)); - g_test_add_vtable (path, - 0, - g_object_ref (widget), - 0, - (GTestFixtureFunc) test_func, - (GTestFixtureFunc) g_object_unref); - g_free (path); -} - -static void -add_child_tests (GtkWidget *widget) -{ - g_object_ref_sink (widget); - add_child_test ("/child/add-remove", (GTestFixtureFunc)test_add_remove, widget); - g_object_unref (widget); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv, NULL); - - g_test_add_func ("/scrolledwindow/child-count", test_scrolled_window_child_count); - - add_child_tests (gtk_scrolled_window_new ()); - add_child_tests (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); - add_child_tests (gtk_paned_new (GTK_ORIENTATION_HORIZONTAL)); - add_child_tests (gtk_grid_new ()); - add_child_tests (gtk_window_new ()); - add_child_tests (gtk_assistant_new ()); - add_child_tests (gtk_frame_new ("frame")); - add_child_tests (gtk_expander_new ("expander")); - add_child_tests (gtk_text_view_new ()); - add_child_tests (gtk_tree_view_new ()); -#if 0 - /* gail doesn't handle non-label children in these */ - add_child_tests (gtk_button_new ()); - add_child_tests (gtk_statusbar_new ()); -#endif - add_child_tests (gtk_notebook_new ()); - add_child_tests (gtk_entry_new ()); - - return g_test_run (); -} - diff --git a/testsuite/a11y/children.test.in b/testsuite/a11y/children.test.in deleted file mode 100644 index 33085b5681..0000000000 --- a/testsuite/a11y/children.test.in +++ /dev/null @@ -1,4 +0,0 @@ -[Test] -Exec=@libexecdir@/installed-tests/gtk-4.0/a11y/children -k --tap -Type=session -Output=TAP diff --git a/testsuite/a11y/colorchooser.txt b/testsuite/a11y/colorchooser.txt deleted file mode 100644 index b0e7b1a99a..0000000000 --- a/testsuite/a11y/colorchooser.txt +++ /dev/null @@ -1,1212 +0,0 @@ -window1 - "dialog" - index: 0 - name: Select a Color - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - ___object_1___ - "filler" - parent: window1 - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - dialog-vbox1 - "filler" - parent: ___object_1___ - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - chooser - "filler" - parent: dialog-vbox1 - index: 0 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "filler" - parent: chooser - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-1 - "panel" - parent: unnamed-GtkContainerAccessible-0 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkColorSwatchAccessible-2 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 0 - name: Light Scarlet Red - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-3 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 1 - name: Scarlet Red - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-4 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 2 - name: Dark Scarlet Red - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-5 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 3 - name: Light Orange - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-6 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 4 - name: Orange - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-7 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 5 - name: Dark Orange - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-8 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 6 - name: Light Butter - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-9 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 7 - name: Butter - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-10 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 8 - name: Dark Butter - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-11 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 9 - name: Light Chameleon - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-12 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 10 - name: Chameleon - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-13 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 11 - name: Dark Chameleon - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-14 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 12 - name: Light Sky Blue - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-15 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 13 - name: Sky Blue - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-16 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 14 - name: Dark Sky Blue - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-17 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 15 - name: Light Plum - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-18 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 16 - name: Plum - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-19 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 17 - name: Dark Plum - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-20 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 18 - name: Light Chocolate - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-21 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 19 - name: Chocolate - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-22 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 20 - name: Dark Chocolate - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-23 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 21 - name: Light Aluminum 1 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-24 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 22 - name: Aluminum 1 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-25 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 23 - name: Dark Aluminum 1 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-26 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 24 - name: Light Aluminum 2 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-27 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 25 - name: Aluminum 2 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-28 - "radio button" - parent: unnamed-GtkContainerAccessible-1 - index: 26 - name: Dark Aluminum 2 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkContainerAccessible-29 - "panel" - parent: unnamed-GtkContainerAccessible-0 - index: 1 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkColorSwatchAccessible-30 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 0 - name: Black - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-31 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 1 - name: Very Dark Gray - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-32 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 2 - name: Darker Gray - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-33 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 3 - name: Dark Gray - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-34 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 4 - name: Medium Gray - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-35 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 5 - name: Light Gray - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-36 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 6 - name: Lighter Gray - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-37 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 7 - name: Very Light Gray - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - unnamed-GtkColorSwatchAccessible-38 - "radio button" - parent: unnamed-GtkContainerAccessible-29 - index: 8 - name: White - state: checked enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - Custom - "label" - parent: unnamed-GtkContainerAccessible-0 - index: 2 - name: Custom - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Custom - character count: 6 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - unnamed-GtkContainerAccessible-39 - "filler" - parent: unnamed-GtkContainerAccessible-0 - index: 3 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkColorSwatchAccessible-40 - "push button" - parent: unnamed-GtkContainerAccessible-39 - index: 0 - name: Custom color - description: Create a custom color - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - GtkColorEditor - "filler" - parent: chooser - index: 1 - state: enabled horizontal sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - overlay - "panel" - parent: GtkColorEditor - index: 0 - state: enabled sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - grid - "panel" - parent: overlay - index: 0 - state: enabled horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - picker_button - "push button" - parent: grid - index: 0 - description: Pick a color from the screen - state: enabled focusable sensitive visible has-tooltip - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: 16 x 16 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - swatch - "radio button" - parent: grid - index: 1 - state: enabled sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: select - action 0 description: Selects the color - action 1 name: activate - action 1 description: Activates the color - action 2 name: customize - action 2 description: Customizes the color - entry - "text" - parent: grid - index: 2 - name: Color Name - state: editable enabled focusable sensitive single-line visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: - character count: 0 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry - h_slider - "color chooser" - parent: grid - index: 3 - name: Hue - state: enabled focusable sensitive vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.000000 - maximum value: 1.000000 - current value: 0.000000 - a_slider - "color chooser" - parent: grid - index: 4 - name: Alpha - state: enabled focusable horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.000000 - maximum value: 1.000000 - current value: 0.000000 - sv_plane - "color chooser" - parent: grid - index: 5 - name: Color Plane - state: enabled focusable sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - sv_popup - "filler" - parent: overlay - index: 1 - state: enabled horizontal sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - grid2 - "panel" - parent: sv_popup - index: 0 - state: enabled horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label1 - "label" - parent: grid2 - index: 0 - name: S - state: enabled focusable multi-line sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: S - character count: 1 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - label2 - "label" - parent: grid2 - index: 1 - name: V - state: enabled focusable multi-line sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: V - character count: 1 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - s_entry - "spin button" - parent: grid2 - index: 2 - name: Saturation - state: enabled focusable horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.000000 - maximum value: 100.000000 - current value: 0.000000 - v_entry - "spin button" - parent: grid2 - index: 3 - name: Value - state: enabled focusable horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.000000 - maximum value: 100.000000 - current value: 0.000000 - h_popup - "filler" - parent: overlay - index: 2 - state: enabled horizontal sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - grid3 - "panel" - parent: h_popup - index: 0 - state: enabled horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label3 - "label" - parent: grid3 - index: 0 - name: H - state: enabled focusable multi-line sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: H - character count: 1 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - h_entry - "spin button" - parent: grid3 - index: 1 - name: Hue - state: enabled focusable horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.000000 - maximum value: 360.000000 - current value: 0.000000 - a_popup - "filler" - parent: overlay - index: 3 - state: enabled horizontal sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - grid4 - "panel" - parent: a_popup - index: 0 - state: enabled horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label4 - "label" - parent: grid4 - index: 0 - name: A - state: enabled focusable multi-line sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: A - character count: 1 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - a_entry - "spin button" - parent: grid4 - index: 1 - name: Alpha - state: enabled focusable horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.000000 - maximum value: 100.000000 - current value: 0.000000 - action_box - "filler" - parent: ___object_1___ - index: 1 - state: enabled horizontal sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - action_area - "filler" - parent: action_box - index: 0 - state: enabled horizontal sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - headerbar - "panel" - parent: window1 - index: 1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - cancel_button - "push button" - parent: unnamed-GtkContainerAccessible-41 - index: 0 - name: Cancel - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action 0 keybinding: <Alt>c - ok_button - "push button" - parent: unnamed-GtkContainerAccessible-42 - index: 0 - name: Select - state: enabled focusable sensitive showing visible default - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - action 0 keybinding: <Alt>s diff --git a/testsuite/a11y/colorchooser.ui b/testsuite/a11y/colorchooser.ui deleted file mode 100644 index 90569f52ab..0000000000 --- a/testsuite/a11y/colorchooser.ui +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkColorChooserDialog" id="window1"> - </object> -</interface> diff --git a/testsuite/a11y/combos.txt b/testsuite/a11y/combos.txt deleted file mode 100644 index 8e15335d95..0000000000 --- a/testsuite/a11y/combos.txt +++ /dev/null @@ -1,274 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box1 - "filler" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label1 - "label" - parent: box1 - index: 0 - name: Combo: - label-for: combo1 - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Combo: - character count: 6 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - combo1 - "combo box" - parent: box1 - index: 1 - labelled-by: label1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: press - action 0 description: Presses the combobox - action 0 keybinding: <Alt>c - <AtkSelection> - popup_widget - "panel" - parent: combo1 - index: 0 - state: enabled sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkStackAccessible-1 - "panel" - parent: unnamed-GtkWidgetAccessible-2 - index: 0 - state: enabled sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - combo2 - "combo box" - parent: box1 - index: 2 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: press - action 0 description: Presses the combobox - <AtkSelection> - popup_widget - "panel" - parent: combo2 - index: 0 - state: enabled sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkStackAccessible-3 - "panel" - parent: unnamed-GtkWidgetAccessible-4 - index: 0 - state: enabled sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - - "text" - parent: combo2 - index: 1 - state: editable enabled focusable sensitive showing single-line visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: - character count: 0 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry - combo3 - "combo box" - parent: box1 - index: 3 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: press - action 0 description: Presses the combobox - <AtkSelection> - popup_widget - "panel" - parent: combo3 - index: 0 - state: enabled sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkStackAccessible-5 - "panel" - parent: unnamed-GtkWidgetAccessible-6 - index: 0 - state: enabled sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - combo4 - "combo box" - parent: box1 - index: 4 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: press - action 0 description: Presses the combobox - <AtkSelection> - popup_widget - "panel" - parent: combo4 - index: 0 - state: enabled sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkStackAccessible-7 - "panel" - parent: unnamed-GtkWidgetAccessible-8 - index: 0 - state: enabled sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - - "text" - parent: combo4 - index: 1 - state: editable enabled focusable sensitive showing single-line visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: - character count: 0 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry diff --git a/testsuite/a11y/combos.ui b/testsuite/a11y/combos.ui deleted file mode 100644 index e80bf1ce94..0000000000 --- a/testsuite/a11y/combos.ui +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkBox" id="box1"> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label">_Combo:</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">combo1</property> - </object> - </child> - <child> - <object class="GtkComboBox" id="combo1"> - <property name="visible">True</property> - </object> - </child> - <child> - <object class="GtkComboBox" id="combo2"> - <property name="visible">True</property> - <property name="has-entry">True</property> - </object> - </child> - <child> - <object class="GtkComboBoxText" id="combo3"> - <property name="visible">True</property> - </object> - </child> - <child> - <object class="GtkComboBoxText" id="combo4"> - <property name="visible">True</property> - <property name="has-entry">True</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/derive.c b/testsuite/a11y/derive.c deleted file mode 100644 index 397097237f..0000000000 --- a/testsuite/a11y/derive.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2012 Red Hat Inc. - * - * Author: - * Matthias Clasen <mclasen@redhat.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <gtk/gtk.h> -#include <gtk/gtk-a11y.h> - -/* Implement a (trivial) GtkButton subclass, derive GtkButtonAccessible - * and use the derived accessible for our new button. - */ - -typedef GtkButtonAccessible MyButtonAccessible; -typedef GtkButtonAccessibleClass MyButtonAccessibleClass; - - -GType my_button_accessible_get_type (void); -G_DEFINE_TYPE (MyButtonAccessible, my_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE) - -static void -my_button_accessible_init (MyButtonAccessible *a) -{ -} - -static void -my_button_accessible_class_init (MyButtonAccessibleClass *class) -{ -} - -typedef GtkButton MyButton; -typedef GtkButtonClass MyButtonClass; - -GType my_button_get_type (void); -G_DEFINE_TYPE (MyButton, my_button, GTK_TYPE_BUTTON) - -static void -my_button_init (MyButton *b) -{ -} - -static void -my_button_class_init (MyButtonClass *class) -{ - gtk_widget_class_set_accessible_type (GTK_WIDGET_CLASS (class), - my_button_accessible_get_type ()); -} - -static void -test_derive (void) -{ - GtkWidget *widget; - GtkAccessible *accessible; - - widget = GTK_WIDGET (g_object_new (my_button_get_type (), NULL)); - accessible = GTK_ACCESSIBLE (gtk_widget_get_accessible (widget)); - - g_assert (G_TYPE_CHECK_INSTANCE_TYPE (accessible, my_button_accessible_get_type ())); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv, NULL); - - g_test_add_func ("/derive", test_derive); - - return g_test_run (); -} diff --git a/testsuite/a11y/derive.test.in b/testsuite/a11y/derive.test.in deleted file mode 100644 index 6c97ca0314..0000000000 --- a/testsuite/a11y/derive.test.in +++ /dev/null @@ -1,4 +0,0 @@ -[Test] -Exec=@libexecdir@/installed-tests/gtk-4.0/a11y/derive -k --tap -Type=session -Output=TAP diff --git a/testsuite/a11y/entries.txt b/testsuite/a11y/entries.txt deleted file mode 100644 index 680807ac5a..0000000000 --- a/testsuite/a11y/entries.txt +++ /dev/null @@ -1,310 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box1 - "filler" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label1 - "label" - parent: box1 - index: 0 - name: entry: - label-for: entry1 - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: entry: - character count: 6 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - label2 - "label" - parent: box1 - index: 1 - name: password entry: - label-for: entry2 - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: password entry: - character count: 15 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - label3 - "label" - parent: box1 - index: 2 - name: spinbutton: - label-for: spinbutton1 - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: spinbutton: - character count: 11 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - entry1 - "text" - parent: box1 - index: 3 - labelled-by: label1 - state: editable enabled focusable focused sensitive showing single-line visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: text - character count: 4 - caret offset: 4 - selection 0: (0, 4) text - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry - action 0 keybinding: <Alt>e - entry2 - "text" - parent: box1 - index: 4 - labelled-by: label2 - state: editable enabled focusable sensitive showing single-line visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: ************* - character count: 13 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry - action 0 keybinding: <Alt>p - entry3 - "text" - parent: box1 - index: 5 - state: editable enabled focusable sensitive showing single-line visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: icons - character count: 5 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry - unnamed-GtkEntryIconAccessible-1 - "icon" - parent: entry3 - name: edit-undo - state: enabled sensitive showing visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: activate - unnamed-GtkEntryIconAccessible-2 - "icon" - parent: entry3 - name: edit-redo - state: enabled sensitive showing visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: activate - spinbutton1 - "spin button" - parent: box1 - index: 6 - labelled-by: label3 - state: enabled focusable horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.500000 - maximum value: 99.500000 - current value: 45.500000 diff --git a/testsuite/a11y/entries.ui b/testsuite/a11y/entries.ui deleted file mode 100644 index b0fd260798..0000000000 --- a/testsuite/a11y/entries.ui +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkAdjustment" id="adjustment1"> - <property name="lower">0.5</property> - <property name="upper">99.5</property> - <property name="page-size">0</property> - <property name="value">45.5</property> - <property name="step-increment">0.5</property> - <property name="page-increment">5.0</property> - </object> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkBox" id="box1"> - <child> - <object class="GtkLabel" id="label1"> - <property name="label">_entry:</property> - <property name="visible">True</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">entry1</property> - </object> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="label">_password entry:</property> - <property name="visible">True</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">entry2</property> - </object> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="label">_spinbutton:</property> - <property name="visible">True</property> - <property name="use-underline">True</property> - <property name="mnemonic-widget">spinbutton1</property> - </object> - </child> - <child> - <object class="GtkEntry" id="entry1"> - <property name="text" translatable="yes">text</property> - <property name="visible">True</property> - </object> - </child> - <child> - <object class="GtkEntry" id="entry2"> - <property name="text" translatable="yes">password text</property> - <property name="visible">True</property> - <property name="visibility">False</property> - <property name="invisible_char">*</property> - <property name="invisible_char_set">True</property> - </object> - </child> - <child> - <object class="GtkEntry" id="entry3"> - <property name="text" translatable="yes">icons</property> - <property name="visible">True</property> - <property name="primary-icon-name">edit-undo</property> - <property name="secondary-icon-name">edit-redo</property> - </object> - </child> - <child> - <object class="GtkSpinButton" id="spinbutton1"> - <property name="adjustment">adjustment1</property> - <property name="visible">True</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/expander.txt b/testsuite/a11y/expander.txt deleted file mode 100644 index 94e0b9aced..0000000000 --- a/testsuite/a11y/expander.txt +++ /dev/null @@ -1,67 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - expander1 - "toggle button" - parent: window1 - index: 0 - name: Reveal this - state: enabled expandable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: activate - action 0 description: Activates the expander - label1 - "label" - name: Hello World! - state: enabled focusable multi-line sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Hello World! - character count: 12 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> diff --git a/testsuite/a11y/expander.ui b/testsuite/a11y/expander.ui deleted file mode 100644 index 76145bb358..0000000000 --- a/testsuite/a11y/expander.ui +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkExpander" id="expander1"> - <property name="label" translatable="yes">Reveal this</property> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="label" translatable="yes">Hello World!</property> - <property name="visible">True</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/headerbar.txt b/testsuite/a11y/headerbar.txt deleted file mode 100644 index 902522aff5..0000000000 --- a/testsuite/a11y/headerbar.txt +++ /dev/null @@ -1,57 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - headerbar1 - "panel" - parent: window1 - index: 0 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "push button" - parent: unnamed-GtkContainerAccessible-1 - index: 0 - name: Yes - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - page2 - "push button" - parent: unnamed-GtkContainerAccessible-2 - index: 0 - name: No - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/headerbar.ui b/testsuite/a11y/headerbar.ui deleted file mode 100644 index a0790778dc..0000000000 --- a/testsuite/a11y/headerbar.ui +++ /dev/null @@ -1,19 +0,0 @@ -<interface> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkHeaderBar" id="headerbar1"> - <property name="show-title-buttons">0</property> - <child type="start"> - <object class="GtkButton" id="button1"> - <property name="label" translatable="yes">Yes</property> - </object> - </child> - <child type="end"> - <object class="GtkButton" id="page2"> - <property name="label" translatable="yes">No</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/hello-world.txt b/testsuite/a11y/hello-world.txt deleted file mode 100644 index b60cf77ae5..0000000000 --- a/testsuite/a11y/hello-world.txt +++ /dev/null @@ -1,32 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "push button" - parent: window1 - index: 0 - name: Hello World! - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/hello-world.ui b/testsuite/a11y/hello-world.ui deleted file mode 100644 index bed92b67b6..0000000000 --- a/testsuite/a11y/hello-world.ui +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkButton" id="button1"> - <property name="label" translatable="yes">Hello World!</property> - <property name="visible">True</property> - <property name="receives_default">True</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/iconview.txt b/testsuite/a11y/iconview.txt deleted file mode 100644 index eb3ed6b412..0000000000 --- a/testsuite/a11y/iconview.txt +++ /dev/null @@ -1,98 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - iv1 - "layered pane" - parent: window1 - index: 0 - state: enabled focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkSelection> - One - "icon" - parent: iv1 - index: 0 - state: enabled focusable selectable sensitive showing visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: One - character count: 3 - caret offset: -1 - <AtkImage> - image size: 0 x 0 - image description: (null) - <AtkAction> - action 0 name: activate - action 0 description: Activate item - Three - "icon" - parent: iv1 - index: 1 - state: enabled focusable selectable sensitive showing visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Three - character count: 5 - caret offset: -1 - <AtkImage> - image size: 0 x 0 - image description: (null) - <AtkAction> - action 0 name: activate - action 0 description: Activate item - Five - "icon" - parent: iv1 - index: 2 - state: enabled focusable selectable sensitive showing visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Five - character count: 4 - caret offset: -1 - <AtkImage> - image size: 0 x 0 - image description: (null) - <AtkAction> - action 0 name: activate - action 0 description: Activate item - Seven - "icon" - parent: iv1 - index: 3 - state: enabled focusable selectable sensitive showing visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Seven - character count: 5 - caret offset: -1 - <AtkImage> - image size: 0 x 0 - image description: (null) - <AtkAction> - action 0 name: activate - action 0 description: Activate item diff --git a/testsuite/a11y/iconview.ui b/testsuite/a11y/iconview.ui deleted file mode 100644 index a12d846b28..0000000000 --- a/testsuite/a11y/iconview.ui +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkListStore" id="liststore1"> - <columns> - <column type="gchararray"/> - <column type="gchararray"/> - </columns> - <data> - <row><col id="0">One</col><col id="1">Two</col></row> - <row><col id="0">Three</col><col id="1">Four</col></row> - <row><col id="0">Five</col><col id="1">Six</col></row> - <row><col id="0">Seven</col><col id="1">Eight</col></row> - </data> - </object> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkIconView" id="iv1"> - <property name="visible">True</property> - <property name="model">liststore1</property> - <child> - <object class="GtkCellRendererText" id="renderer1"> - </object> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/infobar.txt b/testsuite/a11y/infobar.txt deleted file mode 100644 index 19d9bbf4c0..0000000000 --- a/testsuite/a11y/infobar.txt +++ /dev/null @@ -1,118 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - bar1 - "info bar" - parent: window1 - index: 0 - name: Information - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-1 - "panel" - parent: bar1 - index: 0 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-2 - "filler" - parent: unnamed-GtkContainerAccessible-1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-3 - "filler" - parent: unnamed-GtkContainerAccessible-2 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label1 - "label" - parent: unnamed-GtkContainerAccessible-3 - index: 0 - name: Some important info - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Some important info - character count: 19 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - unnamed-GtkContainerAccessible-4 - "filler" - parent: unnamed-GtkContainerAccessible-2 - index: 1 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkButtonAccessible-5 - "push button" - parent: unnamed-GtkContainerAccessible-2 - index: 2 - name: Close - state: enabled focusable sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: 16 x 16 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/infobar.ui b/testsuite/a11y/infobar.ui deleted file mode 100644 index 6348b08dc9..0000000000 --- a/testsuite/a11y/infobar.ui +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkInfoBar" id="bar1"> - <property name="visible">True</property> - <property name="message-type">info</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Some important info</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/label-static.txt b/testsuite/a11y/label-static.txt deleted file mode 100644 index a4ab85a9f9..0000000000 --- a/testsuite/a11y/label-static.txt +++ /dev/null @@ -1,82 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label1 - "static" - parent: window1 - index: 0 - name: Go to the GTK+ website or >google it - state: enabled focusable focused multi-line sensitive showing visible has-tooltip - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Go to the GTK+ website or >google it - character count: 36 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - <AtkHyperlink> - start index: 10 - end index: 22 - anchors: http://www.gtk.org - <AtkHyperlink> - start index: 27 - end index: 36 - anchors: http://www.google.com - unnamed-GtkLabelAccessibleLinkImpl-1 - "link" - parent: label1 - state: enabled focusable focused multi-line sensitive showing visible has-tooltip - <AtkHyperlinkImpl> - <AtkHyperlink> - start index: 10 - end index: 22 - anchors: http://www.gtk.org - unnamed-GtkLabelAccessibleLinkImpl-2 - "link" - parent: label1 - state: enabled focusable multi-line sensitive showing visible has-tooltip - <AtkHyperlinkImpl> - <AtkHyperlink> - start index: 27 - end index: 36 - anchors: http://www.google.com diff --git a/testsuite/a11y/label-static.ui b/testsuite/a11y/label-static.ui deleted file mode 100644 index 08571bd1ee..0000000000 --- a/testsuite/a11y/label-static.ui +++ /dev/null @@ -1,15 +0,0 @@ - -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkLabel" id="label1"> - <property name="label">Go to the <a href="http://www.gtk.org" title="<i>Our</i> website">GTK+ website</a> or <small>><a href="http://www.google.com">google it</a></small></property> - <property name="use-markup">True</property> - <accessibility> - <role type="static"/> - </accessibility> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/label.txt b/testsuite/a11y/label.txt deleted file mode 100644 index 009363646c..0000000000 --- a/testsuite/a11y/label.txt +++ /dev/null @@ -1,82 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label1 - "label" - parent: window1 - index: 0 - name: Go to the GTK+ website or >google it - state: enabled focusable focused multi-line sensitive showing visible has-tooltip - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Go to the GTK+ website or >google it - character count: 36 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - <AtkHyperlink> - start index: 10 - end index: 22 - anchors: http://www.gtk.org - <AtkHyperlink> - start index: 27 - end index: 36 - anchors: http://www.google.com - unnamed-GtkLabelAccessibleLinkImpl-1 - "link" - parent: label1 - state: enabled focusable focused multi-line sensitive showing visible has-tooltip - <AtkHyperlinkImpl> - <AtkHyperlink> - start index: 10 - end index: 22 - anchors: http://www.gtk.org - unnamed-GtkLabelAccessibleLinkImpl-2 - "link" - parent: label1 - state: enabled focusable multi-line sensitive showing visible has-tooltip - <AtkHyperlinkImpl> - <AtkHyperlink> - start index: 27 - end index: 36 - anchors: http://www.google.com diff --git a/testsuite/a11y/label.ui b/testsuite/a11y/label.ui deleted file mode 100644 index 6ad282a2c0..0000000000 --- a/testsuite/a11y/label.ui +++ /dev/null @@ -1,12 +0,0 @@ - -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkLabel" id="label1"> - <property name="label">Go to the <a href="http://www.gtk.org" title="<i>Our</i> website">GTK+ website</a> or <small>><a href="http://www.google.com">google it</a></small></property> - <property name="use-markup">True</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/link.txt b/testsuite/a11y/link.txt deleted file mode 100644 index 9438046142..0000000000 --- a/testsuite/a11y/link.txt +++ /dev/null @@ -1,37 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "push button" - parent: window1 - index: 0 - name: Hello World! - state: enabled focusable focused sensitive showing visible visited has-tooltip - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - <AtkHyperlinkImpl> - <AtkHyperlink> - start index: 0 - end index: 0 - anchors: http://www.gtk.org diff --git a/testsuite/a11y/link.ui b/testsuite/a11y/link.ui deleted file mode 100644 index b91f8af622..0000000000 --- a/testsuite/a11y/link.ui +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkLinkButton" id="button1"> - <property name="label" translatable="yes">Hello World!</property> - <property name="visible">True</property> - <property name="uri">http://www.gtk.org</property> - <property name="visited">True</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/listbox.txt b/testsuite/a11y/listbox.txt deleted file mode 100644 index 86ff7d0f1a..0000000000 --- a/testsuite/a11y/listbox.txt +++ /dev/null @@ -1,192 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box1 - "filler" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - listbox1 - "list box" - parent: box1 - index: 0 - state: enabled sensitive showing visible manages-descendants - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkSelection> - unnamed-GtkListBoxRowAccessible-1 - "list item" - parent: listbox1 - index: 0 - state: enabled focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - row1 - "label" - parent: unnamed-GtkListBoxRowAccessible-1 - index: 0 - name: Row One - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Row One - character count: 7 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - unnamed-GtkListBoxRowAccessible-2 - "list item" - parent: listbox1 - index: 1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - row2 - "label" - parent: unnamed-GtkListBoxRowAccessible-2 - index: 0 - name: Row Two - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Row Two - character count: 7 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - listbox2 - "list box" - parent: box1 - index: 1 - state: enabled sensitive showing visible manages-descendants - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkSelection> - unnamed-GtkListBoxRowAccessible-3 - "list item" - parent: listbox2 - index: 0 - state: enabled selectable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - row3 - "label" - parent: unnamed-GtkListBoxRowAccessible-3 - index: 0 - name: Row Tree - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Row Tree - character count: 8 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> diff --git a/testsuite/a11y/listbox.ui b/testsuite/a11y/listbox.ui deleted file mode 100644 index f87c506018..0000000000 --- a/testsuite/a11y/listbox.ui +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkBox" id="box1"> - <property name="visible">True</property> - <child> - <object class="GtkListBox" id="listbox1"> - <property name="visible">True</property> - <property name="selection-mode">none</property> - <child> - <object class="GtkLabel" id="row1"> - <property name="visible">True</property> - <property name="label">Row One</property> - </object> - </child> - <child> - <object class="GtkLabel" id="row2"> - <property name="visible">True</property> - <property name="label">Row Two</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkListBox" id="listbox2"> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="row3"> - <property name="visible">True</property> - <property name="label">Row Tree</property> - </object> - </child> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/lockbutton.txt b/testsuite/a11y/lockbutton.txt deleted file mode 100644 index b6edba8026..0000000000 --- a/testsuite/a11y/lockbutton.txt +++ /dev/null @@ -1,34 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "push button" - parent: window1 - index: 0 - name: Lock - description: Dialog is unlocked. -Click to prevent further changes - state: enabled focusable focused sensitive showing visible has-tooltip - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/lockbutton.ui b/testsuite/a11y/lockbutton.ui deleted file mode 100644 index 6845ca0fea..0000000000 --- a/testsuite/a11y/lockbutton.ui +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkLockButton" id="button1"> - <property name="visible">True</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/menubutton.txt b/testsuite/a11y/menubutton.txt deleted file mode 100644 index c52d798690..0000000000 --- a/testsuite/a11y/menubutton.txt +++ /dev/null @@ -1,26 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - menubutton - "toggle button" - parent: window1 - index: 0 - name: Menu - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 diff --git a/testsuite/a11y/menubutton.ui b/testsuite/a11y/menubutton.ui deleted file mode 100644 index a0423d57f7..0000000000 --- a/testsuite/a11y/menubutton.ui +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkPopover" id="menu"> - <child> - <object class="GtkButton" id="button"> - <property name="label" translatable="yes">_New</property> - <property name="use_underline">True</property> - </object> - </child> - </object> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkMenuButton" id="menubutton"> - <property name="popover">menu</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/menubutton2.txt b/testsuite/a11y/menubutton2.txt deleted file mode 100644 index c52d798690..0000000000 --- a/testsuite/a11y/menubutton2.txt +++ /dev/null @@ -1,26 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - menubutton - "toggle button" - parent: window1 - index: 0 - name: Menu - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 diff --git a/testsuite/a11y/menubutton2.ui b/testsuite/a11y/menubutton2.ui deleted file mode 100644 index df1f590cc3..0000000000 --- a/testsuite/a11y/menubutton2.ui +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <menu id="menu"> - <section> - <item> - <attribute name="label">New</attribute> - </item> - </section> - </menu> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkMenuButton" id="menubutton"> - <property name="menu-model">menu</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/meson.build b/testsuite/a11y/meson.build deleted file mode 100644 index 4bc3c339a0..0000000000 --- a/testsuite/a11y/meson.build +++ /dev/null @@ -1,156 +0,0 @@ -testexecdir = join_paths(installed_test_bindir, 'a11y') -testdatadir = join_paths(installed_test_datadir, 'a11y') - -a11y_state_tests = [ - 'about', - 'accessible-name', - 'actionbar', - 'assistant', - #'buttons', - 'calendar', - 'colorchooser', - 'combos', - 'entries', - 'expander', - 'headerbar', - 'hello-world', - 'iconview', - 'infobar', - 'label', - 'link', - 'listbox', - 'lockbutton', - 'menubutton', - 'menubutton2', - 'messagedialog', - 'mnemonic', - 'notebook', - 'paned', - 'pickers', - 'placeholder-text', - 'progress', - 'range', - 'scale-drawvalue', - 'spinner', - 'statusbar', - 'stack', - 'text', - 'tooltips', - 'tree', -] - -a11y_dump_bin = executable('accessibility-dump', - 'accessibility-dump.c', - c_args: common_cflags, - dependencies: libgtk_dep, - install: get_option('install-tests'), - install_dir: testexecdir, -) - -foreach t: a11y_state_tests - ui_path = join_paths(meson.current_source_dir(), t + '.ui') - test (t + ' state', - a11y_dump_bin, - args: [ '--tap', '-k', ui_path ], - protocol: 'tap', - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], - suite: 'a11y', - ) -endforeach - -a11y_tests = [ - 'tree-performance', - 'text', - 'children', - 'derive', - 'value', - 'misc', - 'tree-relationships', - 'util', -] - -foreach t: a11y_tests - test_prefix = 'a11y' - - test (t, - executable (t, '@0@.c'.format(t), - install: get_option('install-tests'), - c_args: common_cflags, - install_dir: testexecdir, - dependencies: libgtk_dep), - args: [ '--tap', '-k', ], - protocol: 'tap', - timeout: 120, - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], - suite: 'a11y') -endforeach - -a11y_installed_tests = [ - 'tests.test', - 'children.test', - 'tree.test', - 'value.test', - 'derive.test', - 'text.test', - 'util.test', - 'misc.test', -] - -installed_test_data = [ - 'about.ui', 'about.txt', - 'accessible-name.ui', 'accessible-name.txt', - 'actionbar.ui', 'actionbar.txt', - 'assistant.ui', 'assistant.txt', - 'buttons.ui', 'buttons.txt', - 'calendar.ui', 'calendar.txt', - 'colorchooser.ui', 'colorchooser.txt', - 'combos.ui', 'combos.txt', - 'entries.ui', 'entries.txt', - 'expander.ui', 'expander.txt', - 'headerbar.ui', 'headerbar.txt', - 'hello-world.ui', 'hello-world.txt', - 'iconview.ui', 'iconview.txt', - 'infobar.ui', 'infobar.txt', - 'label.ui', 'label.txt', - 'link.ui', 'link.txt', - 'listbox.ui', 'listbox.txt', - 'lockbutton.ui', 'lockbutton.txt', - 'menubutton.ui', 'menubutton.txt', - 'menubutton2.ui', 'menubutton2.txt', - 'messagedialog.ui', 'messagedialog.txt', - 'mnemonic.ui', 'mnemonic.txt', - 'notebook.ui', 'notebook.txt', - 'paned.ui', 'paned.txt', - 'pickers.ui', 'pickers.txt', - 'placeholder-text.ui', 'placeholder-text.txt', - 'progress.ui', 'progress.txt', - 'range.ui', 'range.txt', - 'scale-drawvalue.ui', 'scale-drawvalue.txt', - 'spinner.ui', 'spinner.txt', - 'stack.ui', 'stack.txt', - 'statusbar.ui', 'statusbar.txt', - 'text.ui', 'text.txt', - 'tooltips.ui', 'tooltips.txt', - 'tree.ui', 'tree.txt', -] - -if get_option('install-tests') - test_cdata = configuration_data() - test_cdata.set('libexecdir', gtk_libexecdir) - - foreach t: a11y_installed_tests - configure_file(input: '@0@.in'.format(t), - output: t, - configuration: test_cdata, - install: true, - install_dir: testdatadir) - endforeach - - install_data(installed_test_data, install_dir: testexecdir) -endif diff --git a/testsuite/a11y/messagedialog.txt b/testsuite/a11y/messagedialog.txt deleted file mode 100644 index e92ce27553..0000000000 --- a/testsuite/a11y/messagedialog.txt +++ /dev/null @@ -1,192 +0,0 @@ -window1 - "alert" - index: 0 - name: Information - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "filler" - parent: window1 - index: 1 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - - "label" - parent: unnamed-GtkContainerAccessible-0 - index: 0 - name: - state: enabled focusable multi-line sensitive - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: - character count: 0 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - ___object_1___ - "filler" - parent: window1 - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - dialog-vbox1 - "filler" - parent: ___object_1___ - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box - "filler" - parent: dialog-vbox1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - message_area - "filler" - parent: box - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label - "label" - parent: message_area - index: 0 - name: Information - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Information - character count: 11 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - secondary_label - "label" - parent: message_area - index: 1 - name: More Information - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: More Information - character count: 16 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - action_box - "filler" - parent: ___object_1___ - index: 1 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - action_area - "filler" - parent: action_box - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 diff --git a/testsuite/a11y/messagedialog.ui b/testsuite/a11y/messagedialog.ui deleted file mode 100644 index a6a080e716..0000000000 --- a/testsuite/a11y/messagedialog.ui +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkMessageDialog" id="window1"> - <property name="visible">True</property> - <property name="message-type">info</property> - <property name="text" translatable="yes">Information</property> - <property name="secondary-text" translatable="yes">More Information</property> - </object> -</interface> diff --git a/testsuite/a11y/misc.c b/testsuite/a11y/misc.c deleted file mode 100644 index aabbf3f26a..0000000000 --- a/testsuite/a11y/misc.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2011 Red Hat Inc. - * - * Author: - * Matthias Clasen <mclasen@redhat.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <gtk/gtk.h> - -static void -test_popover_parent (void) -{ - GtkWidget *w; - GtkWidget *p; - AtkObject *a; - - /*http://bugzilla.gnome.org/show_bug.cgi?id=733923 */ - - w = gtk_entry_new (); - - p = gtk_popover_new (); - a = gtk_widget_get_accessible (p); - - g_assert (a != NULL); - g_assert (atk_object_get_parent (a) == NULL); - - gtk_widget_set_parent (p, w); - - g_assert (atk_object_get_parent (a) != NULL); - - gtk_widget_unparent (w); - g_object_unref (g_object_ref_sink (p)); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv, NULL); - - g_test_add_func ("/popover/accessible-parent", test_popover_parent); - - return g_test_run (); -} - diff --git a/testsuite/a11y/misc.test.in b/testsuite/a11y/misc.test.in deleted file mode 100644 index dcfece4c99..0000000000 --- a/testsuite/a11y/misc.test.in +++ /dev/null @@ -1,4 +0,0 @@ -[Test] -Exec=@libexecdir@/installed-tests/gtk-4.0/a11y/misc -k --tap -Type=session -Output=TAP diff --git a/testsuite/a11y/mnemonic.txt b/testsuite/a11y/mnemonic.txt deleted file mode 100644 index 7071856501..0000000000 --- a/testsuite/a11y/mnemonic.txt +++ /dev/null @@ -1,110 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box1 - "filler" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - label1 - "label" - parent: box1 - index: 0 - name: Entry: - label-for: entry1 - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Entry: - character count: 6 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - entry1 - "text" - parent: box1 - index: 1 - labelled-by: label1 - state: editable enabled focusable focused sensitive showing single-line visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: text - character count: 4 - caret offset: 4 - selection 0: (0, 4) text - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry - action 0 keybinding: <Alt>e diff --git a/testsuite/a11y/mnemonic.ui b/testsuite/a11y/mnemonic.ui deleted file mode 100644 index 2e68cf8122..0000000000 --- a/testsuite/a11y/mnemonic.ui +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkBox" id="box1"> - <child> - <object class="GtkLabel" id="label1"> - <property name="label" translatable="yes">_Entry:</property> - <property name="visible">True</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">entry1</property> - </object> - </child> - <child> - <object class="GtkEntry" id="entry1"> - <property name="text" translatable="yes">text</property> - <property name="visible">True</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/notebook.txt b/testsuite/a11y/notebook.txt deleted file mode 100644 index 66077869d9..0000000000 --- a/testsuite/a11y/notebook.txt +++ /dev/null @@ -1,75 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - notebook1 - "page tab list" - parent: window1 - index: 0 - state: enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkSelection> - selected children: unnamed-GtkNotebookPageAccessible-1 - unnamed-GtkNotebookPageAccessible-1 - "page tab" - parent: notebook1 - index: 0 - name: Tab 1 - state: enabled focusable multi-line selectable selected sensitive showing visible - <AtkComponent> - layer: widget - alpha: 1 - page1 - "push button" - index: 0 - name: Yes - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - unnamed-GtkNotebookPageAccessible-2 - "page tab" - parent: notebook1 - index: 1 - name: Tab 2 - state: enabled focusable multi-line selectable sensitive showing visible - <AtkComponent> - layer: widget - alpha: 1 - page2 - "push button" - index: 0 - name: No - state: enabled focusable sensitive visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/notebook.ui b/testsuite/a11y/notebook.ui deleted file mode 100644 index d37be60088..0000000000 --- a/testsuite/a11y/notebook.ui +++ /dev/null @@ -1,36 +0,0 @@ -<interface> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkNotebook" id="notebook1"> - <child> - <object class="GtkNotebookPage"> - <property name="child"> - <object class="GtkButton" id="page1"> - <property name="label" translatable="yes">Yes</property> - </object> - </property> - <property name="tab"> - <object class="GtkLabel" id="tab1"> - <property name="label" translatable="yes">Tab 1</property> - </object> - </property> - </object> - </child> - <child> - <object class="GtkNotebookPage"> - <property name="child"> - <object class="GtkButton" id="page2"> - <property name="label" translatable="yes">No</property> - </object> - </property> - <property name="tab"> - <object class="GtkLabel" id="tab2"> - <property name="label" translatable="yes">Tab 2</property> - </object> - </property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/paned.txt b/testsuite/a11y/paned.txt deleted file mode 100644 index 26615c026c..0000000000 --- a/testsuite/a11y/paned.txt +++ /dev/null @@ -1,109 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - paned1 - "split pane" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.000000 - maximum value: 219.000000 - current value: 26.000000 - label1 - "label" - parent: paned1 - index: 0 - name: Left - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Left - character count: 4 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> - label2 - "label" - parent: paned1 - index: 1 - name: Right - state: enabled focusable multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Right - character count: 5 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkHypertext> diff --git a/testsuite/a11y/paned.ui b/testsuite/a11y/paned.ui deleted file mode 100644 index 190c41f6fd..0000000000 --- a/testsuite/a11y/paned.ui +++ /dev/null @@ -1,18 +0,0 @@ -<interface> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkPaned" id="paned1"> - <child> - <object class="GtkLabel" id="label1"> - <property name="label" translatable="yes">Left</property> - </object> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="label" translatable="yes">Right</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/pickers.txt b/testsuite/a11y/pickers.txt deleted file mode 100644 index 9b86178e95..0000000000 --- a/testsuite/a11y/pickers.txt +++ /dev/null @@ -1,52 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - grid1 - "panel" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button1 - "unknown" - parent: grid1 - index: 0 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button2 - "unknown" - parent: grid1 - index: 1 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button3 - "unknown" - parent: grid1 - index: 2 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 diff --git a/testsuite/a11y/pickers.ui b/testsuite/a11y/pickers.ui deleted file mode 100644 index 5e85c546a1..0000000000 --- a/testsuite/a11y/pickers.ui +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkGrid" id="grid1"> - <child> - <object class="GtkAppChooserButton" id="button1"> - <layout> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkColorButton" id="button2"> - <layout> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkFontButton" id="button3"> - <layout> - <property name="left_attach">2</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/placeholder-text.txt b/testsuite/a11y/placeholder-text.txt deleted file mode 100644 index 5097da49a4..0000000000 --- a/testsuite/a11y/placeholder-text.txt +++ /dev/null @@ -1,151 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box1 - "filler" - parent: window1 - index: 0 - state: enabled sensitive showing vertical visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - entry1 - "text" - parent: box1 - index: 0 - state: editable enabled focusable focused sensitive showing single-line visible - toolkit: gtk - placeholder-text: Subject or Addresses contain - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: - character count: 0 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry - entry2 - "text" - parent: box1 - index: 1 - state: editable enabled focusable sensitive showing single-line visible - toolkit: gtk - placeholder-text: Message contains - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Some text - character count: 9 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry - entry3 - "text" - parent: box1 - index: 2 - state: editable enabled focusable sensitive showing single-line visible - toolkit: gtk - placeholder-text: Body contains - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: - character count: 0 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - direction: <omitted> - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: activate - action 0 description: Activates the entry diff --git a/testsuite/a11y/placeholder-text.ui b/testsuite/a11y/placeholder-text.ui deleted file mode 100644 index fef5966f85..0000000000 --- a/testsuite/a11y/placeholder-text.ui +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkBox" id="box1"> - <property name="orientation">vertical</property> - <child> - <object class="GtkEntry" id="entry1"> - <property name="placeholder_text">Subject or Addresses contain</property> - </object> - </child> - <child> - <object class="GtkEntry" id="entry2"> - <property name="text" translatable="yes">Some text</property> - <property name="placeholder_text">Message contains</property> - </object> - </child> - <child> - <object class="GtkEntry" id="entry3"> - <property name="placeholder_text">Body contains</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/progress.txt b/testsuite/a11y/progress.txt deleted file mode 100644 index 3248138a23..0000000000 --- a/testsuite/a11y/progress.txt +++ /dev/null @@ -1,29 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - progress1 - "progress bar" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.000000 - maximum value: 1.000000 - current value: 0.500000 diff --git a/testsuite/a11y/progress.ui b/testsuite/a11y/progress.ui deleted file mode 100644 index b87c182995..0000000000 --- a/testsuite/a11y/progress.ui +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkProgressBar" id="progress1"> - <property name="visible">True</property> - <property name="fraction">0.5</property> - <property name="text">Good progress!</property> - <property name="show-text">True</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/range.txt b/testsuite/a11y/range.txt deleted file mode 100644 index 092f810df8..0000000000 --- a/testsuite/a11y/range.txt +++ /dev/null @@ -1,52 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - grid1 - "panel" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - scale1 - "slider" - parent: grid1 - index: 0 - description: 45.5 - state: enabled focusable focused horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.500000 - maximum value: 99.500000 - current value: 45.500000 - scrollbar1 - "scroll bar" - parent: grid1 - index: 1 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: 0.500000 - maximum value: 99.500000 - current value: 45.500000 diff --git a/testsuite/a11y/range.ui b/testsuite/a11y/range.ui deleted file mode 100644 index 2cb26c30e0..0000000000 --- a/testsuite/a11y/range.ui +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <object class="GtkAdjustment" id="adjustment1"> - <property name="lower">0.5</property> - <property name="upper">99.5</property> - <property name="value">45.5</property> - <property name="step-increment">0.5</property> - <property name="page-increment">5.0</property> - </object> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkGrid" id="grid1"> - <child> - <object class="GtkScale" id="scale1"> - <property name="adjustment">adjustment1</property> - <layout> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkScrollbar" id="scrollbar1"> - <property name="adjustment">adjustment1</property> - <layout> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </layout> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/scale-drawvalue.txt b/testsuite/a11y/scale-drawvalue.txt deleted file mode 100644 index f64903d22a..0000000000 --- a/testsuite/a11y/scale-drawvalue.txt +++ /dev/null @@ -1,30 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - scale1 - "slider" - parent: window1 - index: 0 - description: -42.0 - state: enabled focusable focused horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkValue> - minimum value: -100.000000 - maximum value: 100.000000 - current value: -42.000000 diff --git a/testsuite/a11y/scale-drawvalue.ui b/testsuite/a11y/scale-drawvalue.ui deleted file mode 100644 index 82823e548a..0000000000 --- a/testsuite/a11y/scale-drawvalue.ui +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkAdjustment" id="adjustment1"> - <property name="lower">-100</property> - <property name="upper">100</property> - <property name="value">-42</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkScale" id="scale1"> - <property name="width-request">100</property> - <property name="visible">True</property> - <property name="adjustment">adjustment1</property> - <property name="round_digits">1</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/spinner.txt b/testsuite/a11y/spinner.txt deleted file mode 100644 index 20dbdc7228..0000000000 --- a/testsuite/a11y/spinner.txt +++ /dev/null @@ -1,30 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - spinner1 - "animation" - parent: window1 - index: 0 - name: Spinner - description: Provides visual indication of progress - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: 220 x 68 - image description: (null) diff --git a/testsuite/a11y/spinner.ui b/testsuite/a11y/spinner.ui deleted file mode 100644 index 6f8be8cf3c..0000000000 --- a/testsuite/a11y/spinner.ui +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkSpinner" id="spinner1"> - <property name="visible">True</property> - <property name="spinning">True</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/stack.txt b/testsuite/a11y/stack.txt deleted file mode 100644 index 61e2ca1eaf..0000000000 --- a/testsuite/a11y/stack.txt +++ /dev/null @@ -1,91 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box1 - "filler" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - stackswitcher1 - "filler" - parent: box1 - index: 0 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkToggleButtonAccessible-1 - "toggle button" - parent: stackswitcher1 - index: 0 - name: Page 1 - state: checked enabled focusable focused sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - unnamed-GtkToggleButtonAccessible-2 - "toggle button" - parent: stackswitcher1 - index: 1 - name: Page 2 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - stack1 - "panel" - parent: box1 - index: 1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - page1 - "push button" - parent: stack1 - index: 0 - name: Yes - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/stack.ui b/testsuite/a11y/stack.ui deleted file mode 100644 index 4aeb63d6cd..0000000000 --- a/testsuite/a11y/stack.ui +++ /dev/null @@ -1,39 +0,0 @@ -<interface> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkBox" id="box1"> - <child> - <object class="GtkStackSwitcher" id="stackswitcher1"> - <property name="stack">stack1</property> - </object> - </child> - <child> - <object class="GtkStack" id="stack1"> - <child> - <object class="GtkStackPage"> - <property name="name">page1</property> - <property name="title">Page 1</property> - <property name="child"> - <object class="GtkButton" id="page1"> - <property name="label" translatable="yes">Yes</property> - </object> - </property> - </object> - </child> - <child> - <object class="GtkStackPage"> - <property name="name">page2</property> - <property name="title">Page 2</property> - <property name="child"> - <object class="GtkButton" id="page2"> - <property name="label" translatable="yes">No</property> - </object> - </property> - </object> - </child> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/state/focus1.in b/testsuite/a11y/state/focus1.in deleted file mode 100644 index cfe3a315d0..0000000000 --- a/testsuite/a11y/state/focus1.in +++ /dev/null @@ -1,8 +0,0 @@ -record entry1 entry2 -states focused -show window1 -focus entry1 -wait -focus entry2 -wait -destroy window1 diff --git a/testsuite/a11y/state/focus1.out b/testsuite/a11y/state/focus1.out deleted file mode 100644 index 89c56433eb..0000000000 --- a/testsuite/a11y/state/focus1.out +++ /dev/null @@ -1,4 +0,0 @@ -entry1 focused 1 -entry1 focused 0 -entry2 focused 1 -entry2 focused 0 diff --git a/testsuite/a11y/state/focus1.ui b/testsuite/a11y/state/focus1.ui deleted file mode 100644 index 48179e93c1..0000000000 --- a/testsuite/a11y/state/focus1.ui +++ /dev/null @@ -1,22 +0,0 @@ -<interface> - <object class='GtkWindow' id='window1'> - <property name='visible'>True</property> - <child> - <object class='GtkBox' id='box1'> - <property name='visible'>True</property> - <child> - <object class='GtkEntry' id='entry1'> - <property name='visible'>True</property> - <property name='text'>entry1</property> - </object> - </child> - <child> - <object class='GtkEntry' id='entry2'> - <property name='visible'>True</property> - <property name='text'>entry2</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/state/focus2.in b/testsuite/a11y/state/focus2.in deleted file mode 100644 index d66cf175f9..0000000000 --- a/testsuite/a11y/state/focus2.in +++ /dev/null @@ -1,9 +0,0 @@ -record entry1 entry2 window1 window2 -states focused active -show window1 -show window2 -focus entry1 -wait -focus entry2 -wait -destroy window1 window2 diff --git a/testsuite/a11y/state/focus2.out b/testsuite/a11y/state/focus2.out deleted file mode 100644 index 29202463c4..0000000000 --- a/testsuite/a11y/state/focus2.out +++ /dev/null @@ -1,7 +0,0 @@ -entry1 focused 1 -window1 active 1 -entry1 focused 0 -window1 active 0 -entry2 focused 1 -window2 active 1 -entry2 focused 0 diff --git a/testsuite/a11y/state/focus2.ui b/testsuite/a11y/state/focus2.ui deleted file mode 100644 index 2dda5ecc63..0000000000 --- a/testsuite/a11y/state/focus2.ui +++ /dev/null @@ -1,20 +0,0 @@ -<interface> - <object class='GtkWindow' id='window1'> - <property name='visible'>True</property> - <child> - <object class='GtkEntry' id='entry1'> - <property name='visible'>True</property> - <property name='text'>entry1</property> - </object> - </child> - </object> - <object class='GtkWindow' id='window2'> - <property name='visible'>True</property> - <child> - <object class='GtkEntry' id='entry2'> - <property name='visible'>True</property> - <property name='text'>entry2</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/state/state-record.c b/testsuite/a11y/state/state-record.c deleted file mode 100644 index b1f1292336..0000000000 --- a/testsuite/a11y/state/state-record.c +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (C) 2011 Red Hat Inc. - * - * Author: - * Matthias Clasen <mclasen@redhat.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "config.h" -#include <glib/gstdio.h> -#include <gtk/gtk.h> -#include <string.h> - -static char **states; - -static void -record_state_change (AtkObject *accessible, - const char *state, - gboolean set, - GString *string) -{ - GtkWidget *w; - const char *name; - - if (states) - { - int i; - - for (i = 0; states[i]; i++) - { - if (strcmp (states[i], state) == 0) - break; - } - if (states[i] == NULL) - return; - } - - w = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); - name = gtk_buildable_get_name (GTK_BUILDABLE (w)); - g_string_append_printf (string, "%s %s %d\n", name, state, set); -} - -static gboolean -stop (gpointer data) -{ - GMainLoop *loop = data; - - g_main_loop_quit (loop); - - return G_SOURCE_CONTINUE; -} - -static void -do_action (GtkBuilder *builder, const char *action, GString *string) -{ - char **parts; - int len; - int i; - - parts = g_strsplit (action, " ", 0); - len = g_strv_length (parts); - if (len > 0) - { - if (strcmp (parts[0], "record") == 0) - { - for (i = 1; i < len; i++) - { - GObject *o, *a; - - o = gtk_builder_get_object (builder, parts[i]); - if (ATK_IS_OBJECT (o)) - a = o; - else if (GTK_IS_WIDGET (o)) - a = G_OBJECT (gtk_widget_get_accessible (GTK_WIDGET (o))); - else - g_assert_not_reached (); - g_signal_connect (a, "state-change", G_CALLBACK (record_state_change), string); - } - } - else if (strcmp (parts[0], "states") == 0) - { - g_strfreev (states); - states = g_strdupv (parts); - } - else if (strcmp (parts[0], "destroy") == 0) - { - for (i = 1; i < len; i++) - { - GObject *o; - - o = gtk_builder_get_object (builder, parts[i]); - g_object_unref (o); - } - } - else if (strcmp (parts[0], "show") == 0) - { - GObject *o; - - o = gtk_builder_get_object (builder, parts[1]); - gtk_widget_show (GTK_WIDGET (o)); - } - else if (strcmp (parts[0], "focus") == 0) - { - GObject *o; - - o = gtk_builder_get_object (builder, parts[1]); - gtk_widget_grab_focus (GTK_WIDGET (o)); - } - else if (strcmp (parts[0], "wait") == 0) - { - GMainLoop *loop; - gulong id; - - loop = g_main_loop_new (NULL, FALSE); - id = g_timeout_add (1000, stop, loop); - g_main_loop_run (loop); - g_source_remove (id); - g_main_loop_unref (loop); - } - } - g_free (parts); -} - -static void -record_events (const char *ui_file, - const char *in_file, - GString *string) -{ - GtkBuilder *builder; - GError *error; - char *contents; - char **actions; - int i, len; - - builder = gtk_builder_new (); - error = NULL; - gtk_builder_add_from_file (builder, ui_file, &error); - g_assert_no_error (error); - - g_file_get_contents (in_file, &contents, NULL, &error); - g_assert_no_error (error); - actions = g_strsplit (contents, "\n", 0); - - len = g_strv_length (actions); - for (i = 0; i < len; i++) - do_action (builder, actions[i], string); - - g_object_unref (builder); - - g_free (contents); - g_strfreev (actions); -} - -static char * -get_test_file (const char *test_file, - const char *extension, - gboolean must_exist) -{ - GString *file = g_string_new (NULL); - - if (g_str_has_suffix (test_file, ".ui")) - g_string_append_len (file, test_file, strlen (test_file) - strlen (".ui")); - else - g_string_append (file, test_file); - - g_string_append (file, extension); - - if (must_exist && - !g_file_test (file->str, G_FILE_TEST_EXISTS)) - { - g_string_free (file, TRUE); - return NULL; - } - - return g_string_free (file, FALSE); -} - -static char * -diff_with_file (const char *file1, - char *text, - gssize len, - GError **error) -{ - const char *command[] = { "diff", "-u", file1, NULL, NULL }; - char *diff, *tmpfile; - int fd; - - diff = NULL; - - if (len < 0) - len = strlen (text); - - /* write the text buffer to a temporary file */ - fd = g_file_open_tmp (NULL, &tmpfile, error); - if (fd < 0) - return NULL; - - if (write (fd, text, len) != (int) len) - { - close (fd); - g_set_error (error, - G_FILE_ERROR, G_FILE_ERROR_FAILED, - "Could not write data to temporary file '%s'", tmpfile); - goto done; - } - close (fd); - command[3] = tmpfile; - - /* run diff command */ - g_spawn_sync (NULL, - (char **) command, - NULL, - G_SPAWN_SEARCH_PATH, - NULL, NULL, - &diff, - NULL, NULL, - error); -done: - g_unlink (tmpfile); - g_free (tmpfile); - - return diff; -} - -static void -test_ui_file (GFile *file) -{ - char *ui_file, *in_file, *out_file; - GString *record; - GError *error = NULL; - - ui_file = g_file_get_path (file); - in_file = get_test_file (ui_file, ".in", TRUE); - out_file = get_test_file (ui_file, ".out", TRUE); - record = g_string_new (""); - - record_events (ui_file, in_file, record); - - if (out_file) - { - char *diff = diff_with_file (out_file, record->str, record->len, &error); - g_assert_no_error (error); - - if (diff && diff[0]) - { - g_printerr ("Contents don't match expected contents:\n%s", diff); - g_test_fail (); - g_free (diff); - } - } - else if (record->str[0]) - { - g_test_message ("Expected a reference file:\n%s", record->str); - g_test_fail (); - } - - g_string_free (record, TRUE); - g_free (in_file); - g_free (out_file); - g_free (ui_file); -} - -static void -add_test_for_file (GFile *file) -{ - g_test_add_vtable (g_file_get_path (file), - 0, - g_object_ref (file), - (GTestFixtureFunc) NULL, - (GTestFixtureFunc) test_ui_file, - (GTestFixtureFunc) g_object_unref); -} - -static int -compare_files (gconstpointer a, gconstpointer b) -{ - GFile *file1 = G_FILE (a); - GFile *file2 = G_FILE (b); - char *path1, *path2; - int result; - - path1 = g_file_get_path (file1); - path2 = g_file_get_path (file2); - - result = strcmp (path1, path2); - - g_free (path1); - g_free (path2); - - return result; -} - -static void -add_tests_for_files_in_directory (GFile *dir) -{ - GFileEnumerator *enumerator; - GFileInfo *info; - GList *files; - GError *error = NULL; - - enumerator = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, NULL, &error); - g_assert_no_error (error); - files = NULL; - - while ((info = g_file_enumerator_next_file (enumerator, NULL, &error))) - { - const char *filename; - - filename = g_file_info_get_name (info); - - if (!g_str_has_suffix (filename, ".ui")) - { - g_object_unref (info); - continue; - } - - files = g_list_prepend (files, g_file_get_child (dir, filename)); - - g_object_unref (info); - } - - g_assert_no_error (error); - g_object_unref (enumerator); - - files = g_list_sort (files, compare_files); - g_list_foreach (files, (GFunc) add_test_for_file, NULL); - g_list_free_full (files, g_object_unref); -} - -static char *arg_base_dir = NULL; - -static const GOptionEntry test_args[] = { - { "directory", 'd', 0, G_OPTION_ARG_FILENAME, &arg_base_dir, - "Directory to run tests from", "DIR" }, - { NULL } -}; - -int -main (int argc, char *argv[]) -{ - const char *basedir; - GFile *dir; - GError *error = NULL; - GOptionContext *context; - - context = g_option_context_new ("- run GTK state tests"); - g_option_context_add_main_entries (context, test_args, NULL); - g_option_context_set_ignore_unknown_options (context, TRUE); - - if (!g_option_context_parse (context, &argc, &argv, &error)) - { - g_print ("option parsing failed: %s\n", error->message); - return FALSE; - } - - g_option_context_free (context); - - gtk_test_init (&argc, &argv, NULL); - - if (arg_base_dir) - basedir = arg_base_dir; - else - basedir = g_test_get_dir (G_TEST_DIST); - - dir = g_file_new_for_path (basedir); - add_tests_for_files_in_directory (dir); - g_object_unref (dir); - - return g_test_run (); -} - diff --git a/testsuite/a11y/statusbar.txt b/testsuite/a11y/statusbar.txt deleted file mode 100644 index 69af09000d..0000000000 --- a/testsuite/a11y/statusbar.txt +++ /dev/null @@ -1,26 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - statusbar1 - "statusbar" - parent: window1 - index: 0 - name: - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 diff --git a/testsuite/a11y/statusbar.ui b/testsuite/a11y/statusbar.ui deleted file mode 100644 index b704061811..0000000000 --- a/testsuite/a11y/statusbar.ui +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkStatusbar" id="statusbar1"> - <property name="visible">True</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/testfocus.c b/testsuite/a11y/testfocus.c deleted file mode 100644 index 2360f47c32..0000000000 --- a/testsuite/a11y/testfocus.c +++ /dev/null @@ -1,118 +0,0 @@ -#include <gtk/gtk.h> - -static const char * -get_name (gpointer obj) -{ - GtkWidget *widget; - if (obj == NULL) - return "(nil)"; - else if (GTK_IS_WIDGET (obj)) - widget = GTK_WIDGET (obj); - else if (GTK_IS_ACCESSIBLE (obj)) - widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)); - else - return "OOPS"; - if (GTK_IS_BUILDABLE (widget)) - return gtk_buildable_get_name (GTK_BUILDABLE (widget)); - else - return G_OBJECT_TYPE_NAME (widget); -} - -static gboolean -compare_focus (gpointer data) -{ - AtkObject *atk_focus; - AtkObject *gtk_focus; - GtkWidget *focus_widget; - GList *list, *l; - - atk_focus = atk_get_focus_object (); - - focus_widget = NULL; - list = gtk_window_list_toplevels (); - for (l = list; l; l = l->next) - { - GtkWindow *w = l->data; - if (gtk_window_is_active (w)) - { - focus_widget = gtk_window_get_focus (w); - break; - } - } - g_list_free (list); - - if (GTK_IS_WIDGET (focus_widget)) - gtk_focus = gtk_widget_get_accessible (focus_widget); - else - gtk_focus = NULL; - - if (gtk_focus != atk_focus) - g_print ("gtk focus: %s != atk focus: %s\n", - get_name (gtk_focus), get_name (atk_focus)); - - return G_SOURCE_CONTINUE; -} - -static void -notify_cb (GObject *obj, GParamSpec *pspec, gpointer data) -{ - gboolean value; - - if (g_strcmp0 (pspec->name, "has-focus") != 0) - return; - - g_object_get (obj, "has-focus", &value, NULL); - g_print ("widget %s %p has-focus -> %d\n", get_name (obj), obj, value); -} - -static void -state_change_cb (AtkObject *obj, const char *name, gboolean state_set) -{ - AtkStateSet *set; - - set = atk_object_ref_state_set (obj); - g_print ("accessible %s %p focused -> %d\n", get_name (obj), obj, - atk_state_set_contains_state (set, ATK_STATE_FOCUSED)); - g_object_unref (set); -} - -int -main (int argc, char *argv[]) -{ - GtkBuilder *builder; - GtkWidget *window; - GSList *o, *l; - GtkWidget *widget; - AtkObject *accessible; - - gtk_init (&argc, &argv); - - builder = gtk_builder_new (); - gtk_builder_add_from_file (builder, argv[1], NULL); - - window = (GtkWidget *)gtk_builder_get_object (builder, "window1"); - - o = gtk_builder_get_objects (builder); - for (l = o; l;l = l->next) - { - if (!GTK_IS_WIDGET (l->data)) - continue; - - widget = l->data; - g_signal_connect (widget, "notify::has-focus", G_CALLBACK (notify_cb), NULL); - accessible = gtk_widget_get_accessible (widget); - g_signal_connect (accessible, "state-change::focused", G_CALLBACK (state_change_cb), NULL); - - } - g_slist_free (o); - - g_timeout_add (100, compare_focus, NULL); - - gtk_widget_show (window); - - while (TRUE) - g_main_context_iteration (NULL, TRUE); - - return 0; -} - diff --git a/testsuite/a11y/tests.test.in b/testsuite/a11y/tests.test.in deleted file mode 100644 index 2787e6fab2..0000000000 --- a/testsuite/a11y/tests.test.in +++ /dev/null @@ -1,4 +0,0 @@ -[Test] -Exec=@libexecdir@/installed-tests/gtk-4.0/a11y/accessibility-dump --tap -k --verbose --directory @libexecdir@/installed-tests/gtk-4.0/a11y -Type=session -Output=TAP diff --git a/testsuite/a11y/text.c b/testsuite/a11y/text.c deleted file mode 100644 index 23460430f8..0000000000 --- a/testsuite/a11y/text.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* - * Copyright (C) 2011 Red Hat Inc. - * - * Author: - * Matthias Clasen <mclasen@redhat.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <gtk/gtk.h> -#include <string.h> - -static void -set_text (GtkWidget *widget, - const char *text) -{ - if (GTK_IS_LABEL (widget)) - gtk_label_set_text (GTK_LABEL (widget), text); - else if (GTK_IS_EDITABLE (widget)) - gtk_editable_set_text (GTK_EDITABLE (widget), text); - else if (GTK_IS_TEXT_VIEW (widget)) - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)), text, -1); - else - g_assert_not_reached (); -} - -static void -append_text (GtkWidget *widget, - const char *text) -{ - if (GTK_IS_LABEL (widget)) - { - char *tmp; - - tmp = g_strconcat (gtk_label_get_text (GTK_LABEL (widget)), text, NULL); - gtk_label_set_text (GTK_LABEL (widget), tmp); - g_free (tmp); - } - else if (GTK_IS_EDITABLE (widget)) - { - char *tmp; - - tmp = g_strconcat (gtk_editable_get_text (GTK_EDITABLE (widget)), text, NULL); - gtk_editable_set_text (GTK_EDITABLE (widget), tmp); - g_free (tmp); - } - else if (GTK_IS_TEXT_VIEW (widget)) - { - GtkTextBuffer *buffer; - GtkTextIter end; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - gtk_text_buffer_get_end_iter (buffer, &end); - gtk_text_buffer_insert (buffer, &end, text, -1); - } - else - g_assert_not_reached (); -} - -static void -test_basic (GtkWidget *widget) -{ - AtkText *atk_text; - const char *text = "Text goes here"; - char *ret; - int count; - gunichar c; - - atk_text = ATK_TEXT (gtk_widget_get_accessible (widget)); - - set_text (widget, text); - ret = atk_text_get_text (atk_text, 5, 9); - g_assert_cmpstr (ret, ==, "goes"); - g_free (ret); - - ret = atk_text_get_text (atk_text, 0, 14); - g_assert_cmpstr (ret, ==, text); - g_free (ret); - - ret = atk_text_get_text (atk_text, 0, -1); - g_assert_cmpstr (ret, ==, text); - g_free (ret); - - count = atk_text_get_character_count (atk_text); - g_assert_cmpint (count, ==, g_utf8_strlen (text, -1)); - - c = atk_text_get_character_at_offset (atk_text, 0); - g_assert_cmpint (c, ==, 'T'); - - c = atk_text_get_character_at_offset (atk_text, 13); - g_assert_cmpint (c, ==, 'e'); -} - -typedef struct { - int count; - int position; - int length; -} SignalData; - -static void -text_deleted (AtkText *atk_text, int position, int length, SignalData *data) -{ - data->count++; - data->position = position; - data->length = length; -} - -static void -text_inserted (AtkText *atk_text, int position, int length, SignalData *data) -{ - data->count++; - data->position = position; - data->length = length; -} - -static void -test_text_changed (GtkWidget *widget) -{ - AtkText *atk_text; - const char *text = "Täxt goes here"; - const char *text2 = "Täxt again"; - SignalData delete_data; - SignalData insert_data; - gboolean cant_append = FALSE; - - if (GTK_IS_LABEL (widget) || GTK_IS_TEXT (widget)) - cant_append = TRUE; - - atk_text = ATK_TEXT (gtk_widget_get_accessible (widget)); - - delete_data.count = 0; - insert_data.count = 0; - - g_signal_connect (atk_text, "text_changed::delete", - G_CALLBACK (text_deleted), &delete_data); - g_signal_connect (atk_text, "text_changed::insert", - G_CALLBACK (text_inserted), &insert_data); - - set_text (widget, text); - - g_assert_cmpint (delete_data.count, ==, 0); - - g_assert_cmpint (insert_data.count, ==, 1); - g_assert_cmpint (insert_data.position, ==, 0); - g_assert_cmpint (insert_data.length, ==, g_utf8_strlen (text, -1)); - - delete_data.count = 0; - insert_data.count = 0; - - append_text (widget, text2); - - if (cant_append) - { - g_assert_cmpint (delete_data.count, ==, 1); - g_assert_cmpint (delete_data.position, ==, 0); - g_assert_cmpint (delete_data.length, ==, g_utf8_strlen (text, -1)); - - g_assert_cmpint (insert_data.count, ==, 1); - g_assert_cmpint (insert_data.position, ==, 0); - g_assert_cmpint (insert_data.length, ==, g_utf8_strlen (text, -1) + g_utf8_strlen (text2, -1)); - } - else - { - g_assert_cmpint (delete_data.count, ==, 0); - - g_assert_cmpint (insert_data.count, ==, 1); - g_assert_cmpint (insert_data.position, ==, g_utf8_strlen (text, -1)); - g_assert_cmpint (insert_data.length, ==, g_utf8_strlen (text2, -1)); - } - - delete_data.count = 0; - insert_data.count = 0; - - set_text (widget, ""); - - g_assert_cmpint (delete_data.count, ==, 1); - g_assert_cmpint (delete_data.position, ==, 0); - g_assert_cmpint (delete_data.length, ==, g_utf8_strlen (text, -1) + g_utf8_strlen (text2, -1)); - - g_assert_cmpint (insert_data.count, ==, 0); - - g_signal_handlers_disconnect_by_func (atk_text, G_CALLBACK (text_deleted), &delete_data); - g_signal_handlers_disconnect_by_func (atk_text, G_CALLBACK (text_inserted), &insert_data); -} - -typedef struct { - int gravity; - int offset; - AtkTextBoundary boundary; - int start; - int end; - const char *word; -} Word; - -#ifdef DUMP_RESULTS -static const char * -boundary (AtkTextBoundary b) -{ - switch (b) - { - case ATK_TEXT_BOUNDARY_CHAR: return "ATK_TEXT_BOUNDARY_CHAR, "; - case ATK_TEXT_BOUNDARY_WORD_START: return "ATK_TEXT_BOUNDARY_WORD_START, "; - case ATK_TEXT_BOUNDARY_WORD_END: return "ATK_TEXT_BOUNDARY_WORD_END, "; - case ATK_TEXT_BOUNDARY_SENTENCE_START: return "ATK_TEXT_BOUNDARY_SENTENCE_START,"; - case ATK_TEXT_BOUNDARY_SENTENCE_END: return "ATK_TEXT_BOUNDARY_SENTENCE_END, "; - case ATK_TEXT_BOUNDARY_LINE_START: return "ATK_TEXT_BOUNDARY_LINE_START, "; - case ATK_TEXT_BOUNDARY_LINE_END: return "ATK_TEXT_BOUNDARY_LINE_END, "; - default: g_assert_not_reached (); - } -} - -static const char * -gravity (int g) -{ - if (g < 0) return "before"; - else if (g > 0) return "after"; - else return "around"; -} - -const char * -char_rep (gunichar c) -{ - static char out[6]; - - switch (c) - { - case '\n': return "\\n"; - case 196: return "?"; - case 214: return "?"; - case 220: return "?"; - default: - memset (out, 0, 6); - g_unichar_to_utf8 (c, out); - return out; - } -} - -char * -escape (const char *p) -{ - GString *s; - - s = g_string_new (""); - - while (*p) - { - if (*p == '\n') - g_string_append (s, "\\n"); - else - g_string_append_c (s, *p); - p++; - } - - return g_string_free (s, FALSE); -} -#endif - -#ifdef SHOW_TEXT_ATTRIBUTES -static void -show_text_attributes (PangoLayout *l) -{ - const PangoLogAttr *attr; - int n_attrs; - const char *s; - char e; - const char *p; - int i; - const char *text; - GSList *lines, *li; - glong so, eo; - - printf ("\n"); - - text = pango_layout_get_text (l); - attr = pango_layout_get_log_attrs_readonly (l, &n_attrs); - - p = text; - while (*p) - { - s = char_rep (g_utf8_get_char (p)); - printf (" %s", s); - p = g_utf8_next_char (p); - } - printf ("\n"); - p = text; - i = 0; - do - { - if (*p) - s = char_rep (g_utf8_get_char (p)); - else - s = ""; - if (attr[i].is_word_start && attr[i].is_word_end) - e = '|'; - else if (attr[i].is_word_start) - e = '<'; - else if (attr[i].is_word_end) - e = '>'; - else - e = ' '; - printf ("%c%*s", e, strlen (s), ""); - if (*p) - p = g_utf8_next_char (p); - i++; - } - while (*p || i < n_attrs); - printf ("\n"); - - p = text; - i = 0; - do - { - if (*p) - s = char_rep (g_utf8_get_char (p)); - else - s = ""; - if (attr[i].is_sentence_start && attr[i].is_sentence_end) - e = '|'; - else if (attr[i].is_sentence_start) - e = '<'; - else if (attr[i].is_sentence_end) - e = '>'; - else - e = ' '; - printf ("%c%*s", e, strlen (s), ""); - if (*p) - p = g_utf8_next_char (p); - i++; - } - while (*p || i < n_attrs); - printf ("\n"); - - lines = pango_layout_get_lines_readonly (l); - p = text; - i = 0; - do - { - gboolean start, end; - - if (*p) - s = char_rep (g_utf8_get_char (p)); - else - s = ""; - start = end = FALSE; - for (li = lines; li; li = li->next) - { - PangoLayoutLine *line = li->data; - so = g_utf8_pointer_to_offset (text, text + line->start_index); - eo = g_utf8_pointer_to_offset (text, text + line->start_index + line->length); - if (so == i) - start = TRUE; - if (eo == i) - end = TRUE; - } - if (start && end) - e = '|'; - else if (start) - e = '<'; - else if (end) - e = '>'; - else - e = ' '; - printf ("%c%*s", e, strlen (s), ""); - if (*p) - p = g_utf8_next_char (p); - i++; - } - while (*p || i < n_attrs); - printf ("\n"); -} -#endif - -static void -test_words (GtkWidget *widget) -{ - AtkText *atk_text; - const char *text = "abc! def\nghi jkl\nmno"; - Word expected[] = { - { -1, 0, ATK_TEXT_BOUNDARY_CHAR, 0, 0, "" }, - { -1, 1, ATK_TEXT_BOUNDARY_CHAR, 0, 1, "a" }, - { -1, 2, ATK_TEXT_BOUNDARY_CHAR, 1, 2, "b" }, - { -1, 3, ATK_TEXT_BOUNDARY_CHAR, 2, 3, "c" }, - { -1, 4, ATK_TEXT_BOUNDARY_CHAR, 3, 4, "!" }, - { -1, 5, ATK_TEXT_BOUNDARY_CHAR, 4, 5, " " }, - { -1, 6, ATK_TEXT_BOUNDARY_CHAR, 5, 6, "d" }, - { -1, 7, ATK_TEXT_BOUNDARY_CHAR, 6, 7, "e" }, - { -1, 8, ATK_TEXT_BOUNDARY_CHAR, 7, 8, "f" }, - { -1, 9, ATK_TEXT_BOUNDARY_CHAR, 8, 9, "\n" }, - { -1, 10, ATK_TEXT_BOUNDARY_CHAR, 9, 10, "g" }, - { -1, 11, ATK_TEXT_BOUNDARY_CHAR, 10, 11, "h" }, - { -1, 12, ATK_TEXT_BOUNDARY_CHAR, 11, 12, "i" }, - { -1, 13, ATK_TEXT_BOUNDARY_CHAR, 12, 13, " " }, - { -1, 14, ATK_TEXT_BOUNDARY_CHAR, 13, 14, "j" }, - { -1, 15, ATK_TEXT_BOUNDARY_CHAR, 14, 15, "k" }, - { -1, 16, ATK_TEXT_BOUNDARY_CHAR, 15, 16, "l" }, - { -1, 17, ATK_TEXT_BOUNDARY_CHAR, 16, 17, "\n" }, - { -1, 18, ATK_TEXT_BOUNDARY_CHAR, 17, 18, "m" }, - { -1, 19, ATK_TEXT_BOUNDARY_CHAR, 18, 19, "n" }, - { -1, 20, ATK_TEXT_BOUNDARY_CHAR, 19, 20, "o" }, - { -1, 0, ATK_TEXT_BOUNDARY_WORD_START, 0, 0, "" }, - { -1, 1, ATK_TEXT_BOUNDARY_WORD_START, 0, 0, "" }, - { -1, 2, ATK_TEXT_BOUNDARY_WORD_START, 0, 0, "" }, - { -1, 3, ATK_TEXT_BOUNDARY_WORD_START, 0, 0, "" }, - { -1, 4, ATK_TEXT_BOUNDARY_WORD_START, 0, 0, "" }, - { -1, 5, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { -1, 6, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { -1, 7, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { -1, 8, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { -1, 9, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { -1, 10, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { -1, 11, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { -1, 12, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { -1, 13, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { -1, 14, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { -1, 15, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { -1, 16, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { -1, 17, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { -1, 18, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { -1, 19, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { -1, 20, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { -1, 0, ATK_TEXT_BOUNDARY_WORD_END, 0, 0, "" }, - { -1, 1, ATK_TEXT_BOUNDARY_WORD_END, 0, 0, "" }, - { -1, 2, ATK_TEXT_BOUNDARY_WORD_END, 0, 0, "" }, - { -1, 3, ATK_TEXT_BOUNDARY_WORD_END, 0, 3, "abc" }, - { -1, 4, ATK_TEXT_BOUNDARY_WORD_END, 0, 3, "abc" }, - { -1, 5, ATK_TEXT_BOUNDARY_WORD_END, 0, 3, "abc" }, - { -1, 6, ATK_TEXT_BOUNDARY_WORD_END, 0, 3, "abc" }, - { -1, 7, ATK_TEXT_BOUNDARY_WORD_END, 0, 3, "abc" }, - { -1, 8, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { -1, 9, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { -1, 10, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { -1, 11, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { -1, 12, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { -1, 13, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { -1, 14, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { -1, 15, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { -1, 16, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { -1, 17, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { -1, 18, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { -1, 19, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { -1, 20, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { -1, 0, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 0, "" }, - { -1, 1, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 0, "" }, - { -1, 2, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 0, "" }, - { -1, 3, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 0, "" }, - { -1, 4, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 0, "" }, - { -1, 5, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { -1, 6, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { -1, 7, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { -1, 8, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { -1, 9, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { -1, 10, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { -1, 11, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { -1, 12, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { -1, 13, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { -1, 14, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { -1, 15, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { -1, 16, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { -1, 17, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { -1, 18, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { -1, 19, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { -1, 20, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { -1, 0, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 0, "" }, - { -1, 1, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 0, "" }, - { -1, 2, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 0, "" }, - { -1, 3, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 0, "" }, - { -1, 4, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 4, "abc!" }, - { -1, 5, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 4, "abc!" }, - { -1, 6, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 4, "abc!" }, - { -1, 7, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 4, "abc!" }, - { -1, 8, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { -1, 9, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { -1, 10, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { -1, 11, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { -1, 12, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { -1, 13, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { -1, 14, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { -1, 15, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { -1, 16, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { -1, 17, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { -1, 18, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { -1, 19, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { -1, 20, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { -1, 0, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 1, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 2, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 3, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 4, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 5, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 6, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 7, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 8, ATK_TEXT_BOUNDARY_LINE_START, 0, 0, "" }, - { -1, 9, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { -1, 10, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { -1, 11, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { -1, 12, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { -1, 13, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { -1, 14, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { -1, 15, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { -1, 16, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { -1, 17, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { -1, 18, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { -1, 19, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { -1, 20, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { -1, 0, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 1, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 2, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 3, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 4, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 5, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 6, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 7, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 8, ATK_TEXT_BOUNDARY_LINE_END, 0, 0, "" }, - { -1, 9, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { -1, 10, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { -1, 11, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { -1, 12, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { -1, 13, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { -1, 14, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { -1, 15, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { -1, 16, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { -1, 17, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { -1, 18, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { -1, 19, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { -1, 20, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 0, ATK_TEXT_BOUNDARY_CHAR, 0, 1, "a" }, - { 0, 1, ATK_TEXT_BOUNDARY_CHAR, 1, 2, "b" }, - { 0, 2, ATK_TEXT_BOUNDARY_CHAR, 2, 3, "c" }, - { 0, 3, ATK_TEXT_BOUNDARY_CHAR, 3, 4, "!" }, - { 0, 4, ATK_TEXT_BOUNDARY_CHAR, 4, 5, " " }, - { 0, 5, ATK_TEXT_BOUNDARY_CHAR, 5, 6, "d" }, - { 0, 6, ATK_TEXT_BOUNDARY_CHAR, 6, 7, "e" }, - { 0, 7, ATK_TEXT_BOUNDARY_CHAR, 7, 8, "f" }, - { 0, 8, ATK_TEXT_BOUNDARY_CHAR, 8, 9, "\n" }, - { 0, 9, ATK_TEXT_BOUNDARY_CHAR, 9, 10, "g" }, - { 0, 10, ATK_TEXT_BOUNDARY_CHAR, 10, 11, "h" }, - { 0, 11, ATK_TEXT_BOUNDARY_CHAR, 11, 12, "i" }, - { 0, 12, ATK_TEXT_BOUNDARY_CHAR, 12, 13, " " }, - { 0, 13, ATK_TEXT_BOUNDARY_CHAR, 13, 14, "j" }, - { 0, 14, ATK_TEXT_BOUNDARY_CHAR, 14, 15, "k" }, - { 0, 15, ATK_TEXT_BOUNDARY_CHAR, 15, 16, "l" }, - { 0, 16, ATK_TEXT_BOUNDARY_CHAR, 16, 17, "\n" }, - { 0, 17, ATK_TEXT_BOUNDARY_CHAR, 17, 18, "m" }, - { 0, 18, ATK_TEXT_BOUNDARY_CHAR, 18, 19, "n" }, - { 0, 19, ATK_TEXT_BOUNDARY_CHAR, 19, 20, "o" }, - { 0, 20, ATK_TEXT_BOUNDARY_CHAR, 20, 20, "" }, - { 0, 0, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { 0, 1, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { 0, 2, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { 0, 3, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { 0, 4, ATK_TEXT_BOUNDARY_WORD_START, 0, 5, "abc! " }, - { 0, 5, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 0, 6, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 0, 7, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 0, 8, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 0, 9, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { 0, 10, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { 0, 11, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { 0, 12, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { 0, 13, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { 0, 14, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { 0, 15, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { 0, 16, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { 0, 17, ATK_TEXT_BOUNDARY_WORD_START, 17, 20, "mno" }, - { 0, 18, ATK_TEXT_BOUNDARY_WORD_START, 17, 20, "mno" }, - { 0, 19, ATK_TEXT_BOUNDARY_WORD_START, 17, 20, "mno" }, - { 0, 20, ATK_TEXT_BOUNDARY_WORD_START, 17, 20, "mno" }, - { 0, 0, ATK_TEXT_BOUNDARY_WORD_END, 0, 3, "abc" }, - { 0, 1, ATK_TEXT_BOUNDARY_WORD_END, 0, 3, "abc" }, - { 0, 2, ATK_TEXT_BOUNDARY_WORD_END, 0, 3, "abc" }, - { 0, 3, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { 0, 4, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { 0, 5, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { 0, 6, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { 0, 7, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { 0, 8, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 0, 9, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 0, 10, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 0, 11, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 0, 12, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { 0, 13, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { 0, 14, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { 0, 15, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { 0, 16, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { 0, 17, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { 0, 18, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { 0, 19, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { 0, 20, ATK_TEXT_BOUNDARY_WORD_END, 20, 20, "" }, - { 0, 0, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { 0, 1, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { 0, 2, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { 0, 3, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { 0, 4, ATK_TEXT_BOUNDARY_SENTENCE_START, 0, 5, "abc! " }, - { 0, 5, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 0, 6, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 0, 7, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 0, 8, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 0, 9, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 0, 10, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 0, 11, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 0, 12, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 0, 13, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 0, 14, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 0, 15, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 0, 16, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 0, 17, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 0, 18, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 0, 19, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 0, 20, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 0, 0, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 4, "abc!" }, - { 0, 1, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 4, "abc!" }, - { 0, 2, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 4, "abc!" }, - { 0, 3, ATK_TEXT_BOUNDARY_SENTENCE_END, 0, 4, "abc!" }, - { 0, 4, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { 0, 5, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { 0, 6, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { 0, 7, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { 0, 8, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 0, 9, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 0, 10, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 0, 11, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 0, 12, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 0, 13, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 0, 14, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 0, 15, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 0, 16, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 0, 17, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 0, 18, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 0, 19, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 0, 20, ATK_TEXT_BOUNDARY_SENTENCE_END, 20, 20, "" }, - { 0, 0, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 1, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 2, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 3, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 4, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 5, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 6, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 7, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 8, ATK_TEXT_BOUNDARY_LINE_START, 0, 9, "abc! def\n" }, - { 0, 9, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 0, 10, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 0, 11, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 0, 12, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 0, 13, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 0, 14, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 0, 15, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 0, 16, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 0, 17, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 0, 18, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 0, 19, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 0, 20, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 0, 0, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 1, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 2, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 3, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 4, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 5, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 6, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 7, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 8, ATK_TEXT_BOUNDARY_LINE_END, 0, 8, "abc! def" }, - { 0, 9, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 10, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 11, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 12, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 13, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 14, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 15, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 16, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 0, 17, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 0, 18, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 0, 19, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 0, 20, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 0, ATK_TEXT_BOUNDARY_CHAR, 1, 2, "b" }, - { 1, 1, ATK_TEXT_BOUNDARY_CHAR, 2, 3, "c" }, - { 1, 2, ATK_TEXT_BOUNDARY_CHAR, 3, 4, "!" }, - { 1, 3, ATK_TEXT_BOUNDARY_CHAR, 4, 5, " " }, - { 1, 4, ATK_TEXT_BOUNDARY_CHAR, 5, 6, "d" }, - { 1, 5, ATK_TEXT_BOUNDARY_CHAR, 6, 7, "e" }, - { 1, 6, ATK_TEXT_BOUNDARY_CHAR, 7, 8, "f" }, - { 1, 7, ATK_TEXT_BOUNDARY_CHAR, 8, 9, "\n" }, - { 1, 8, ATK_TEXT_BOUNDARY_CHAR, 9, 10, "g" }, - { 1, 9, ATK_TEXT_BOUNDARY_CHAR, 10, 11, "h" }, - { 1, 10, ATK_TEXT_BOUNDARY_CHAR, 11, 12, "i" }, - { 1, 11, ATK_TEXT_BOUNDARY_CHAR, 12, 13, " " }, - { 1, 12, ATK_TEXT_BOUNDARY_CHAR, 13, 14, "j" }, - { 1, 13, ATK_TEXT_BOUNDARY_CHAR, 14, 15, "k" }, - { 1, 14, ATK_TEXT_BOUNDARY_CHAR, 15, 16, "l" }, - { 1, 15, ATK_TEXT_BOUNDARY_CHAR, 16, 17, "\n" }, - { 1, 16, ATK_TEXT_BOUNDARY_CHAR, 17, 18, "m" }, - { 1, 17, ATK_TEXT_BOUNDARY_CHAR, 18, 19, "n" }, - { 1, 18, ATK_TEXT_BOUNDARY_CHAR, 19, 20, "o" }, - { 1, 19, ATK_TEXT_BOUNDARY_CHAR, 20, 20, "" }, - { 1, 20, ATK_TEXT_BOUNDARY_CHAR, 20, 20, "" }, - { 1, 0, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 1, 1, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 1, 2, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 1, 3, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 1, 4, ATK_TEXT_BOUNDARY_WORD_START, 5, 9, "def\n" }, - { 1, 5, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { 1, 6, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { 1, 7, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { 1, 8, ATK_TEXT_BOUNDARY_WORD_START, 9, 13, "ghi " }, - { 1, 9, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { 1, 10, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { 1, 11, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { 1, 12, ATK_TEXT_BOUNDARY_WORD_START, 13, 17, "jkl\n" }, - { 1, 13, ATK_TEXT_BOUNDARY_WORD_START, 17, 20, "mno" }, - { 1, 14, ATK_TEXT_BOUNDARY_WORD_START, 17, 20, "mno" }, - { 1, 15, ATK_TEXT_BOUNDARY_WORD_START, 17, 20, "mno" }, - { 1, 16, ATK_TEXT_BOUNDARY_WORD_START, 17, 20, "mno" }, - { 1, 17, ATK_TEXT_BOUNDARY_WORD_START, 20, 20, "" }, - { 1, 18, ATK_TEXT_BOUNDARY_WORD_START, 20, 20, "" }, - { 1, 19, ATK_TEXT_BOUNDARY_WORD_START, 20, 20, "" }, - { 1, 20, ATK_TEXT_BOUNDARY_WORD_START, 20, 20, "" }, - { 1, 0, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { 1, 1, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { 1, 2, ATK_TEXT_BOUNDARY_WORD_END, 3, 8, "! def" }, - { 1, 3, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 1, 4, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 1, 5, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 1, 6, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 1, 7, ATK_TEXT_BOUNDARY_WORD_END, 8, 12, "\nghi" }, - { 1, 8, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { 1, 9, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { 1, 10, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { 1, 11, ATK_TEXT_BOUNDARY_WORD_END, 12, 16, " jkl" }, - { 1, 12, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { 1, 13, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { 1, 14, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { 1, 15, ATK_TEXT_BOUNDARY_WORD_END, 16, 20, "\nmno" }, - { 1, 16, ATK_TEXT_BOUNDARY_WORD_END, 20, 20, "" }, - { 1, 17, ATK_TEXT_BOUNDARY_WORD_END, 20, 20, "" }, - { 1, 18, ATK_TEXT_BOUNDARY_WORD_END, 20, 20, "" }, - { 1, 19, ATK_TEXT_BOUNDARY_WORD_END, 20, 20, "" }, - { 1, 20, ATK_TEXT_BOUNDARY_WORD_END, 20, 20, "" }, - { 1, 0, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 1, 1, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 1, 2, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 1, 3, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 1, 4, ATK_TEXT_BOUNDARY_SENTENCE_START, 5, 9, "def\n" }, - { 1, 5, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 1, 6, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 1, 7, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 1, 8, ATK_TEXT_BOUNDARY_SENTENCE_START, 9, 17, "ghi jkl\n" }, - { 1, 9, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 1, 10, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 1, 11, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 1, 12, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 1, 13, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 1, 14, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 1, 15, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 1, 16, ATK_TEXT_BOUNDARY_SENTENCE_START, 17, 20, "mno" }, - { 1, 17, ATK_TEXT_BOUNDARY_SENTENCE_START, 20, 20, "" }, - { 1, 18, ATK_TEXT_BOUNDARY_SENTENCE_START, 20, 20, "" }, - { 1, 19, ATK_TEXT_BOUNDARY_SENTENCE_START, 20, 20, "" }, - { 1, 20, ATK_TEXT_BOUNDARY_SENTENCE_START, 20, 20, "" }, - { 1, 0, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { 1, 1, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { 1, 2, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { 1, 3, ATK_TEXT_BOUNDARY_SENTENCE_END, 4, 8, " def" }, - { 1, 4, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 1, 5, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 1, 6, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 1, 7, ATK_TEXT_BOUNDARY_SENTENCE_END, 8, 16, "\nghi jkl" }, - { 1, 8, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 1, 9, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 1, 10, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 1, 11, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 1, 12, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 1, 13, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 1, 14, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 1, 15, ATK_TEXT_BOUNDARY_SENTENCE_END, 16, 20, "\nmno" }, - { 1, 16, ATK_TEXT_BOUNDARY_SENTENCE_END, 20, 20, "" }, - { 1, 17, ATK_TEXT_BOUNDARY_SENTENCE_END, 20, 20, "" }, - { 1, 18, ATK_TEXT_BOUNDARY_SENTENCE_END, 20, 20, "" }, - { 1, 19, ATK_TEXT_BOUNDARY_SENTENCE_END, 20, 20, "" }, - { 1, 20, ATK_TEXT_BOUNDARY_SENTENCE_END, 20, 20, "" }, - { 1, 0, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 1, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 2, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 3, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 4, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 5, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 6, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 7, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 8, ATK_TEXT_BOUNDARY_LINE_START, 9, 17, "ghi jkl\n" }, - { 1, 9, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 1, 10, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 1, 11, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 1, 12, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 1, 13, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 1, 14, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 1, 15, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 1, 16, ATK_TEXT_BOUNDARY_LINE_START, 17, 20, "mno" }, - { 1, 17, ATK_TEXT_BOUNDARY_LINE_START, 20, 20, "" }, - { 1, 18, ATK_TEXT_BOUNDARY_LINE_START, 20, 20, "" }, - { 1, 19, ATK_TEXT_BOUNDARY_LINE_START, 20, 20, "" }, - { 1, 20, ATK_TEXT_BOUNDARY_LINE_START, 20, 20, "" }, - { 1, 0, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 1, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 2, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 3, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 4, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 5, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 6, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 7, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 8, ATK_TEXT_BOUNDARY_LINE_END, 8, 16, "\nghi jkl" }, - { 1, 9, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 10, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 11, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 12, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 13, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 14, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 15, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 16, ATK_TEXT_BOUNDARY_LINE_END, 16, 20, "\nmno" }, - { 1, 17, ATK_TEXT_BOUNDARY_LINE_END, 20, 20, "" }, - { 1, 18, ATK_TEXT_BOUNDARY_LINE_END, 20, 20, "" }, - { 1, 19, ATK_TEXT_BOUNDARY_LINE_END, 20, 20, "" }, - { 1, 20, ATK_TEXT_BOUNDARY_LINE_END, 20, 20, "" }, - { 0, -1, } - }; - int start, end; - char *word; - int i; - - atk_text = ATK_TEXT (gtk_widget_get_accessible (widget)); - - set_text (widget, text); -#ifdef SHOW_TEXT_ATTRIBUTES - if (GTK_IS_LABEL (widget)) - show_text_attributes (gtk_label_get_layout (GTK_LABEL (widget))); - else if (GTK_IS_ENTRY (widget)) - show_text_attributes (gtk_entry_get_layout (GTK_ENTRY (widget))); -#endif - -#ifdef DUMP_RESULTS - for (i = -1; i <= 1; i++) - { - int j, k; - for (j = ATK_TEXT_BOUNDARY_CHAR; j <= ATK_TEXT_BOUNDARY_LINE_END; j++) - for (k = 0; k <= strlen (text); k++) - { - switch (i) - { - case -1: - word = atk_text_get_text_before_offset (atk_text, k, j, &start, &end); - break; - case 0: - word = atk_text_get_text_at_offset (atk_text, k, j, &start, &end); - break; - case 1: - word = atk_text_get_text_after_offset (atk_text, k, j, &start, &end); - break; - default: - g_assert_not_reached (); - break; - } - printf (" { %2d, %2d, %s %2d, %2d, \"%s\" },\n", i, k, boundary(j), start, end, escape (word)); - g_free (word); - } - } -#endif - - for (i = 0; expected[i].offset != -1; i++) - { - if (GTK_IS_TEXT (widget)) - { - /* GtkText sets single-paragraph mode on its pango layout */ - if (expected[i].boundary == ATK_TEXT_BOUNDARY_LINE_START || - expected[i].boundary == ATK_TEXT_BOUNDARY_LINE_END) - continue; - } - - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - switch (expected[i].gravity) - { - case -1: - word = atk_text_get_text_before_offset (atk_text, - expected[i].offset, - expected[i].boundary, - &start, &end); - break; - case 0: - word = atk_text_get_text_at_offset (atk_text, - expected[i].offset, - expected[i].boundary, - &start, &end); - break; - case 1: - word = atk_text_get_text_after_offset (atk_text, - expected[i].offset, - expected[i].boundary, - &start, &end); - break; - default: - g_assert_not_reached (); - break; - } - G_GNUC_END_IGNORE_DEPRECATIONS; - - g_assert_cmpstr (word, ==, expected[i].word); - g_assert_cmpint (start, ==, expected[i].start); - g_assert_cmpint (end, ==, expected[i].end); - g_free (word); - } -} - -static void -select_region (GtkWidget *widget, - int start, - int end) -{ - if (GTK_IS_EDITABLE (widget)) - gtk_editable_select_region (GTK_EDITABLE (widget), start, end); - else if (GTK_IS_LABEL (widget)) - gtk_label_select_region (GTK_LABEL (widget), start, end); - else if (GTK_IS_TEXT_VIEW (widget)) - { - GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - GtkTextIter start_iter, end_iter; - - gtk_text_buffer_get_iter_at_offset (buffer, &start_iter, end); - gtk_text_buffer_get_iter_at_offset (buffer, &end_iter, start); - - gtk_text_buffer_select_range (buffer, &start_iter, &end_iter); - } - else - g_assert_not_reached (); -} - -typedef struct { - int count; - int position; - int bound; -} SelectionData; - -static void -caret_moved_cb (AtkText *text, int position, SelectionData *data) -{ - data->count++; - data->position = position; -} - -static void -selection_changed_cb (AtkText *text, SelectionData *data) -{ - data->count++; - - atk_text_get_selection (text, 0, &data->bound, &data->position); -} - -static void -test_selection (GtkWidget *widget) -{ - AtkText *atk_text; - const char *text = "Bla bla bla"; - int n; - char *ret; - int start, end; - SelectionData data1; - SelectionData data2; - - if (GTK_IS_LABEL (widget)) - gtk_label_set_selectable (GTK_LABEL (widget), TRUE); - - atk_text = ATK_TEXT (gtk_widget_get_accessible (widget)); - - data1.count = 0; - data2.count = 0; - g_signal_connect (atk_text, "text_caret_moved", - G_CALLBACK (caret_moved_cb), &data1); - g_signal_connect (atk_text, "text_selection_changed", - G_CALLBACK (selection_changed_cb), &data2); - - set_text (widget, text); - - n = atk_text_get_n_selections (atk_text); - g_assert_cmpint (n, ==, 0); - - if (data1.count == 1) - /* insertion before cursor */ - g_assert_cmpint (data1.position, ==, 11); - else - /* insertion after cursor */ - g_assert_cmpint (data1.count, ==, 0); - g_assert_cmpint (data2.count, ==, 0); - - select_region (widget, 4, 7); - - g_assert_cmpint (data1.count, >=, 1); - g_assert_cmpint (data1.position, ==, 7); - g_assert_cmpint (data2.count, >=, 1); - g_assert_cmpint (data2.bound, ==, 4); - g_assert_cmpint (data2.position, ==, 7); - - n = atk_text_get_n_selections (atk_text); - g_assert_cmpint (n, ==, 1); - - ret = atk_text_get_selection (atk_text, 0, &start, &end); - g_assert_cmpstr (ret, ==, "bla"); - g_assert_cmpint (start, ==, 4); - g_assert_cmpint (end, ==, 7); - g_free (ret); - - atk_text_remove_selection (atk_text, 0); - n = atk_text_get_n_selections (atk_text); - g_assert_cmpint (n, ==, 0); - - g_assert_cmpint (data1.count, >=, 1); - g_assert_cmpint (data2.count, >=, 2); - g_assert_cmpint (data2.position, ==, 7); - g_assert_cmpint (data2.bound, ==, 7); -} - -static void -setup_test (GtkWidget *widget) -{ - set_text (widget, ""); -} - -static void -add_text_test (const char *prefix, - GTestFixtureFunc test_func, - GtkWidget *widget) -{ - char *path; - - path = g_strdup_printf ("%s/%s", prefix, G_OBJECT_TYPE_NAME (widget)); - g_test_add_vtable (path, - 0, - g_object_ref (widget), - (GTestFixtureFunc) setup_test, - (GTestFixtureFunc) test_func, - (GTestFixtureFunc) g_object_unref); - g_free (path); -} - -static void -add_text_tests (GtkWidget *widget) -{ - g_object_ref_sink (widget); - add_text_test ("/text/basic", (GTestFixtureFunc) test_basic, widget); - add_text_test ("/text/words", (GTestFixtureFunc) test_words, widget); - add_text_test ("/text/changed", (GTestFixtureFunc) test_text_changed, widget); - add_text_test ("/text/selection", (GTestFixtureFunc) test_selection, widget); - g_object_unref (widget); -} - -static void -test_bold_label (void) -{ - GtkWidget *label; - AtkObject *atk_obj; - char *text; - - /*http://bugzilla.gnome.org/show_bug.cgi?id=126797 */ - - label = gtk_label_new ("<b>Bold?</b>"); - g_object_ref_sink (label); - - atk_obj = gtk_widget_get_accessible (label); - - text = atk_text_get_text (ATK_TEXT (atk_obj), 0, -1); - g_assert_cmpstr (text, ==, "<b>Bold?</b>"); - g_free (text); - - gtk_label_set_use_markup (GTK_LABEL (label), TRUE); - - text = atk_text_get_text (ATK_TEXT (atk_obj), 0, -1); - g_assert_cmpstr (text, ==, "Bold?"); - g_free (text); - - g_object_unref (label); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv, NULL); - - g_test_add_func ("/text/bold/GtkLabel", test_bold_label); - - add_text_tests (gtk_label_new ("")); - add_text_tests (gtk_text_new ()); - add_text_tests (gtk_text_view_new ()); - - return g_test_run (); -} diff --git a/testsuite/a11y/text.test.in b/testsuite/a11y/text.test.in deleted file mode 100644 index e2421dca23..0000000000 --- a/testsuite/a11y/text.test.in +++ /dev/null @@ -1,4 +0,0 @@ -[Test] -Exec=@libexecdir@/installed-tests/gtk-4.0/a11y/text --tap -k -Type=session -Output=TAP diff --git a/testsuite/a11y/text.txt b/testsuite/a11y/text.txt deleted file mode 100644 index bf0977be30..0000000000 --- a/testsuite/a11y/text.txt +++ /dev/null @@ -1,55 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - text1 - "text" - parent: window1 - index: 0 - state: editable enabled focused multi-line sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Twas brillig, and the slithy toves -Did gyre and gimple in the wabe - character count: 66 - caret offset: 66 - default attributes: bg-color: <omitted> - bg-full-height: false - direction: <omitted> - editable: true - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: none diff --git a/testsuite/a11y/text.ui b/testsuite/a11y/text.ui deleted file mode 100644 index d8fde1ed6a..0000000000 --- a/testsuite/a11y/text.ui +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkTextBuffer" id="buffer1"> - <property name="text">Twas brillig, and the slithy toves -Did gyre and gimple in the wabe</property> - </object> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkTextView" id="text1"> - <property name="visible">True</property> - <property name="buffer">buffer1</property> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/tooltips.txt b/testsuite/a11y/tooltips.txt deleted file mode 100644 index c2e98c2e25..0000000000 --- a/testsuite/a11y/tooltips.txt +++ /dev/null @@ -1,86 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - box1 - "filler" - parent: window1 - index: 0 - state: enabled horizontal sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - button-with-tooltip-text - "push button" - parent: box1 - index: 0 - description: Tooltip1 - state: enabled focusable focused sensitive showing visible has-tooltip - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button-with-has-tooltip-true - "push button" - parent: box1 - index: 1 - state: enabled focusable sensitive showing visible has-tooltip - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button-without-tooltip - "push button" - parent: box1 - index: 2 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - button-with-has-tooltip-false - "push button" - parent: box1 - index: 3 - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button diff --git a/testsuite/a11y/tooltips.ui b/testsuite/a11y/tooltips.ui deleted file mode 100644 index 4c5145cbe9..0000000000 --- a/testsuite/a11y/tooltips.ui +++ /dev/null @@ -1,33 +0,0 @@ -<interface> - <object class='GtkWindow' id='window1'> - <property name='visible'>True</property> - <child> - <object class='GtkBox' id='box1'> - <property name='visible'>True</property> - <child> - <object class='GtkButton' id='button-with-tooltip-text'> - <property name='visible'>True</property> - <property name="tooltip_text">Tooltip1</property> - </object> - </child> - <child> - <object class='GtkButton' id='button-with-has-tooltip-true'> - <property name='visible'>True</property> - <property name="has_tooltip">True</property> - </object> - </child> - <child> - <object class='GtkButton' id='button-without-tooltip'> - <property name='visible'>True</property> - </object> - </child> - <child> - <object class='GtkButton' id='button-with-has-tooltip-false'> - <property name='visible'>True</property> - <property name="has_tooltip">False</property> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/tree-performance.c b/testsuite/a11y/tree-performance.c deleted file mode 100644 index d04bbb7adc..0000000000 --- a/testsuite/a11y/tree-performance.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Copyright (C) 2011 Red Hat Inc. - * - * Author: - * Matthias Clasen <mclasen@redhat.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <gtk/gtk.h> - -#define N_ROWS 10000 - -const char list_ui[] = - "<interface>" - " <object class='GtkListStore' id='liststore1'>" - " <columns>" - " <column type='gchararray'/>" - " <column type='gchararray'/>" - " <column type='gchararray'/>" - " <column type='gboolean'/>" - " <column type='gint'/>" - " <column type='gint'/>" - " </columns>" - " <data>" - " <row><col id='0'>One</col><col id='1'>Two</col><col id='2'>Three</col><col id='3'>True</col><col id='4'>50</col><col id='5'>50</col></row>" - " </data>" - " </object>" - " <object class='GtkWindow' id='window1'>" - " <child>" - " <object class='GtkTreeView' id='treeview1'>" - " <property name='visible'>True</property>" - " <property name='model'>liststore1</property>" - " <child>" - " <object class='GtkTreeViewColumn' id='column1'>" - " <property name='title' translatable='yes'>First column</property>" - " <child>" - " <object class='GtkCellRendererText' id='renderer1'>" - " </object>" - " <attributes>" - " <attribute name='text'>0</attribute>" - " </attributes>" - " </child>" - " <child>" - " <object class='GtkCellRendererToggle' id='renderer2'>" - " </object>" - " <attributes>" - " <attribute name='active'>3</attribute>" - " </attributes>" - " </child>" - " </object>" - " </child>" - " <child>" - " <object class='GtkTreeViewColumn' id='column2'>" - " <property name='title' translatable='yes'>Second column</property>" - " <child>" - " <object class='GtkCellRendererText' id='renderer3'>" - " </object>" - " <attributes>" - " <attribute name='text'>1</attribute>" - " </attributes>" - " </child>" - " <child>" - " <object class='GtkCellRendererProgress' id='renderer4'>" - " </object>" - " <attributes>" - " <attribute name='value'>4</attribute>" - " </attributes>" - " </child>" - " </object>" - " </child>" - " </object>" - " </child>" - " </object>" - "</interface>"; - -static void -walk_accessible_tree (AtkObject *accessible, - gpointer data) -{ - int *count = data; - int i; - - (*count)++; - - for (i = 0; i < atk_object_get_n_accessible_children (accessible); i++) - { - AtkObject *child = atk_object_ref_accessible_child (accessible, i); - walk_accessible_tree (child, data); - g_object_unref (child); - } -} - -static GtkWidget * -builder_get_toplevel (GtkBuilder *builder) -{ - GSList *list, *walk; - GtkWidget *window = NULL; - - list = gtk_builder_get_objects (builder); - for (walk = list; walk; walk = walk->next) - { - if (GTK_IS_WINDOW (walk->data) && - gtk_widget_get_parent (walk->data) == NULL) - { - window = walk->data; - break; - } - } - - g_slist_free (list); - - return window; -} - -static void -populate_list (GtkBuilder *builder) -{ - GtkTreeView *tv; - GtkListStore *store; - GtkTreeIter iter; - int i; - - tv = (GtkTreeView *)gtk_builder_get_object (builder, "treeview1"); - store = (GtkListStore *)gtk_tree_view_get_model (tv); - - /* append a many rows */ - for (i = 0; i < N_ROWS; i++) - { - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, "Bla", 1, "Bla bla", 2, "Bla bla bla", 3, i % 2 == 0 ? TRUE : FALSE, 4, i % 100, 5, i, -1); - } -} - -static void -test_performance_list (void) -{ - GtkBuilder *builder; - double elapsed; - GtkWidget *window; - GError *error = NULL; - - builder = gtk_builder_new (); - gtk_builder_add_from_string (builder, list_ui, -1, &error); - g_assert_no_error (error); - window = builder_get_toplevel (builder); - g_assert (window); - - gtk_widget_show (window); - - g_test_timer_start (); - - populate_list (builder); - - elapsed = g_test_timer_elapsed (); - g_test_minimized_result (elapsed, "large list test: %gsec", elapsed); - g_object_unref (builder); -} - -static void -test_a11y_performance_list (void) -{ - GtkBuilder *builder; - double elapsed; - GtkWidget *window; - GError *error = NULL; - int count_before; - int count_after; - - builder = gtk_builder_new (); - gtk_builder_add_from_string (builder, list_ui, -1, &error); - g_assert_no_error (error); - window = builder_get_toplevel (builder); - g_assert (window); - - gtk_widget_show (window); - - g_test_timer_start (); - - /* make sure all accessibles exist */ - count_before = 0; - walk_accessible_tree (gtk_widget_get_accessible (window), &count_before); - - populate_list (builder); - - /* for good measure, do this again */ - count_after = 0; - walk_accessible_tree (gtk_widget_get_accessible (window), &count_after); - - elapsed = g_test_timer_elapsed (); - g_test_minimized_result (elapsed, "large list with a11y: %gsec", elapsed); - g_object_unref (builder); - - g_test_message ("%d accessibles before, %d after\n", count_before, count_after); -} - -const char tree_ui[] = - "<interface>" - " <object class='GtkTreeStore' id='treestore1'>" - " <columns>" - " <column type='gchararray'/>" - " <column type='gchararray'/>" - " <column type='gchararray'/>" - " <column type='gboolean'/>" - " <column type='gint'/>" - " <column type='gint'/>" - " </columns>" - " </object>" - " <object class='GtkWindow' id='window1'>" - " <child>" - " <object class='GtkTreeView' id='treeview1'>" - " <property name='visible'>True</property>" - " <property name='model'>treestore1</property>" - " <child>" - " <object class='GtkTreeViewColumn' id='column1'>" - " <property name='title' translatable='yes'>First column</property>" - " <child>" - " <object class='GtkCellRendererText' id='renderer1'>" - " </object>" - " <attributes>" - " <attribute name='text'>0</attribute>" - " </attributes>" - " </child>" - " <child>" - " <object class='GtkCellRendererToggle' id='renderer2'>" - " </object>" - " <attributes>" - " <attribute name='active'>3</attribute>" - " </attributes>" - " </child>" - " </object>" - " </child>" - " <child>" - " <object class='GtkTreeViewColumn' id='column2'>" - " <property name='title' translatable='yes'>Second column</property>" - " <child>" - " <object class='GtkCellRendererText' id='renderer3'>" - " </object>" - " <attributes>" - " <attribute name='text'>1</attribute>" - " </attributes>" - " </child>" - " <child>" - " <object class='GtkCellRendererProgress' id='renderer4'>" - " </object>" - " <attributes>" - " <attribute name='value'>4</attribute>" - " </attributes>" - " </child>" - " </object>" - " </child>" - " </object>" - " </child>" - " </object>" - "</interface>"; - -static void -populate_tree (GtkBuilder *builder) -{ - GtkTreeView *tv; - GtkTreeStore *store; - GtkTreeIter iter; - int i; - - tv = (GtkTreeView *)gtk_builder_get_object (builder, "treeview1"); - store = (GtkTreeStore *)gtk_tree_view_get_model (tv); - - /* append a thousand rows */ - for (i = 0; i < N_ROWS / 3; i++) - { - gtk_tree_store_append (store, &iter, NULL); - gtk_tree_store_set (store, &iter, 0, "Bla", 1, "Bla bla", 2, "Bla bla bla", 3, i % 2 == 0 ? TRUE : FALSE, 4, i % 100, 5, i, -1); - gtk_tree_store_append (store, &iter, &iter); - gtk_tree_store_set (store, &iter, 0, "Bla", 1, "Bla bla", 2, "Bla bla bla", 3, i % 2 == 0 ? TRUE : FALSE, 4, i % 100, 5, i, -1); - gtk_tree_store_append (store, &iter, &iter); - gtk_tree_store_set (store, &iter, 0, "Bla", 1, "Bla bla", 2, "Bla bla bla", 3, i % 2 == 0 ? TRUE : FALSE, 4, i % 100, 5, i, -1); - } - - gtk_tree_view_expand_all (tv); -} - -static void -test_performance_tree (void) -{ - GtkBuilder *builder; - double elapsed; - GtkWidget *window; - GError *error = NULL; - - builder = gtk_builder_new (); - gtk_builder_add_from_string (builder, tree_ui, -1, &error); - g_assert_no_error (error); - window = builder_get_toplevel (builder); - g_assert (window); - - gtk_widget_show (window); - - g_test_timer_start (); - - populate_tree (builder); - - elapsed = g_test_timer_elapsed (); - g_test_minimized_result (elapsed, "large tree test: %gsec", elapsed); - g_object_unref (builder); -} - -static void -test_a11y_performance_tree (void) -{ - GtkBuilder *builder; - double elapsed; - GtkWidget *window; - GError *error = NULL; - int count_before; - int count_after; - - builder = gtk_builder_new (); - gtk_builder_add_from_string (builder, tree_ui, -1, &error); - g_assert_no_error (error); - window = builder_get_toplevel (builder); - g_assert (window); - - gtk_widget_show (window); - - g_test_timer_start (); - - /* make sure all accessibles exist */ - count_before = 0; - walk_accessible_tree (gtk_widget_get_accessible (window), &count_before); - - populate_tree (builder); - - /* for good measure, do this again */ - count_after = 0; - walk_accessible_tree (gtk_widget_get_accessible (window), &count_after); - - elapsed = g_test_timer_elapsed (); - g_test_minimized_result (elapsed, "large tree with a11y: %gsec", elapsed); - g_object_unref (builder); - - g_test_message ("%d accessibles before, %d after\n", count_before, count_after); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv, NULL); - - if (!g_test_perf ()) - return 0; - - g_test_add_func ("/performance/list", test_performance_list); - g_test_add_func ("/a11y/performance/list", test_a11y_performance_list); - g_test_add_func ("/performance/tree", test_performance_tree); - g_test_add_func ("/a11y/performance/tree", test_a11y_performance_tree); - - return g_test_run (); -} diff --git a/testsuite/a11y/tree-relationships.c b/testsuite/a11y/tree-relationships.c deleted file mode 100644 index 852bf3429f..0000000000 --- a/testsuite/a11y/tree-relationships.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright (C) 2011 SUSE Linux Products GmbH, Nurenberg, Germany - * - * Author: - * Mike Gorse <mgorse@suse.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <gtk/gtk.h> - -const char list_ui[] = - "<interface>" - " <object class='GtkListStore' id='liststore1'>" - " <columns>" - " <column type='gchararray'/>" - " <column type='gchararray'/>" - " <column type='gchararray'/>" - " <column type='gboolean'/>" - " <column type='gint'/>" - " <column type='gint'/>" - " </columns>" - " <data>" - " <row><col id='0'>One</col><col id='1'>Two</col><col id='2'>Three</col><col id='3'>True</col><col id='4'>50</col><col id='5'>50</col></row>" - " </data>" - " </object>" - " <object class='GtkWindow' id='window1'>" - " <child>" - " <object class='GtkTreeView' id='treeview1'>" - " <property name='visible'>True</property>" - " <property name='model'>liststore1</property>" - " <child>" - " <object class='GtkTreeViewColumn' id='column1'>" - " <property name='title' translatable='yes'>First column</property>" - " <child>" - " <object class='GtkCellRendererText' id='renderer1'>" - " </object>" - " <attributes>" - " <attribute name='text'>0</attribute>" - " </attributes>" - " </child>" - " <child>" - " <object class='GtkCellRendererToggle' id='renderer2'>" - " </object>" - " <attributes>" - " <attribute name='active'>3</attribute>" - " </attributes>" - " </child>" - " </object>" - " </child>" - " <child>" - " <object class='GtkTreeViewColumn' id='column2'>" - " <property name='title' translatable='yes'>Second column</property>" - " <child>" - " <object class='GtkCellRendererText' id='renderer3'>" - " </object>" - " <attributes>" - " <attribute name='text'>1</attribute>" - " </attributes>" - " </child>" - " <child>" - " <object class='GtkCellRendererProgress' id='renderer4'>" - " </object>" - " <attributes>" - " <attribute name='value'>4</attribute>" - " </attributes>" - " </child>" - " </object>" - " </child>" - " </object>" - " </child>" - " </object>" - "</interface>"; - -static GtkWidget * -builder_get_toplevel (GtkBuilder *builder) -{ - GSList *list, *walk; - GtkWidget *window = NULL; - - list = gtk_builder_get_objects (builder); - for (walk = list; walk; walk = walk->next) - { - if (GTK_IS_WINDOW (walk->data) && - gtk_widget_get_parent (walk->data) == NULL) - { - window = walk->data; - break; - } - } - - g_slist_free (list); - - return window; -} - -const char tree_ui[] = - "<interface>" - " <object class='GtkTreeStore' id='treestore1'>" - " <columns>" - " <column type='gchararray'/>" - " <column type='gchararray'/>" - " <column type='gchararray'/>" - " <column type='gboolean'/>" - " <column type='gint'/>" - " <column type='gint'/>" - " </columns>" - " </object>" - " <object class='GtkWindow' id='window1'>" - " <child>" - " <object class='GtkTreeView' id='treeview1'>" - " <property name='visible'>True</property>" - " <property name='model'>treestore1</property>" - " <child>" - " <object class='GtkTreeViewColumn' id='column1'>" - " <property name='title' translatable='yes'>First column</property>" - " <child>" - " <object class='GtkCellRendererText' id='renderer1'>" - " </object>" - " <attributes>" - " <attribute name='text'>0</attribute>" - " </attributes>" - " </child>" - " <child>" - " <object class='GtkCellRendererToggle' id='renderer2'>" - " </object>" - " <attributes>" - " <attribute name='active'>3</attribute>" - " </attributes>" - " </child>" - " </object>" - " </child>" - " <child>" - " <object class='GtkTreeViewColumn' id='column2'>" - " <property name='title' translatable='yes'>Second column</property>" - " <child>" - " <object class='GtkCellRendererText' id='renderer3'>" - " </object>" - " <attributes>" - " <attribute name='text'>1</attribute>" - " </attributes>" - " </child>" - " <child>" - " <object class='GtkCellRendererProgress' id='renderer4'>" - " </object>" - " <attributes>" - " <attribute name='value'>4</attribute>" - " </attributes>" - " </child>" - " </object>" - " </child>" - " </object>" - " </child>" - " </object>" - "</interface>"; - -static void -populate_tree (GtkBuilder *builder) -{ - GtkTreeView *tv; - GtkTreeStore *store; - GtkTreeIter iter; - - tv = (GtkTreeView *)gtk_builder_get_object (builder, "treeview1"); - store = (GtkTreeStore *)gtk_tree_view_get_model (tv); - - /* append some rows */ - gtk_tree_store_append (store, &iter, NULL); - gtk_tree_store_set (store, &iter, 0, "a(1)", 1, "a(2)", 2, "a(3)", 3, TRUE, 4, 0, 5, 0, -1); - gtk_tree_store_append (store, &iter, &iter); - gtk_tree_store_set (store, &iter, 0, "aa(1)", 1, "aa(2)", 2, "aa(3)", 3, TRUE, 4, 0, 5, 0, -1); - gtk_tree_store_append (store, &iter, &iter); - gtk_tree_store_set (store, &iter, 0, "aaa(1)", 1, "aaa(2)", 2, "aaa(3)", 3, TRUE, 4, 0, 5, 0, -1); - - gtk_tree_store_append (store, &iter, NULL); - gtk_tree_store_set (store, &iter, 0, "b(1)", 1, "b(2)", 2, "b(3)", 3, TRUE, 4, 0, 5, 0, -1); - gtk_tree_store_append (store, &iter, &iter); - gtk_tree_store_set (store, &iter, 0, "bb(1)", 1, "bb(2)", 2, "bb(3)", 3, TRUE, 4, 0, 5, 0, -1); - gtk_tree_store_append (store, &iter, &iter); - gtk_tree_store_set (store, &iter, 0, "bbb(1)", 1, "bbb(2)", 2, "bbb(3)", 3, TRUE, 4, 0, 5, 0, -1); -} - -typedef struct { - int count; - AtkObject *descendant; -} SignalData; - -static void -active_descendant_changed (AtkObject *accessible, - AtkObject *descendant, - SignalData *data) -{ - data->count++; - if (data->descendant) - g_object_unref (data->descendant); - data->descendant = g_object_ref (descendant); -} - -static gboolean -quit_loop (gpointer data) -{ - GMainLoop *loop = data; - g_main_loop_quit (loop); - return FALSE; -} - -static void -process_pending_idles (void) -{ - GMainLoop *loop = g_main_loop_new (NULL, FALSE); - g_idle_add (quit_loop, loop); - g_main_loop_run (loop); -} - -static void -test_a11y_tree_focus (void) -{ - GtkBuilder *builder; - GtkWidget *window; - GError *error = NULL; - GtkTreeView *tv; - GtkTreePath *path = NULL; - GtkTreeViewColumn *focus_column = NULL; - SignalData data; - AtkObject *accessible; - AtkObject *child; - char *text; - - builder = gtk_builder_new (); - gtk_builder_add_from_string (builder, tree_ui, -1, &error); - g_assert_no_error (error); - window = builder_get_toplevel (builder); - g_assert (window); - - populate_tree (builder); - - tv = (GtkTreeView *)gtk_builder_get_object (builder, "treeview1"); - gtk_tree_view_expand_all (tv); - - gtk_widget_show (window); - - gtk_tree_view_get_cursor (tv, &path, &focus_column); - gtk_tree_path_down (path); - data.count = 0; - data.descendant = NULL; - accessible = gtk_widget_get_accessible (GTK_WIDGET (tv)); - g_signal_connect (accessible, "active_descendant_changed", - G_CALLBACK (active_descendant_changed), &data); - gtk_tree_view_set_cursor (tv, path, focus_column, FALSE); - /* hack: active_descendant_change gets fired in an idle handler */ - process_pending_idles (); - /* Getting only one signal might be ideal, although we get three or so */ - g_assert_cmpint (data.count, >=, 1); - child = atk_object_ref_accessible_child (data.descendant, 0); - text = atk_text_get_text (ATK_TEXT (child), 0, -1); - g_assert_cmpstr (text, ==, "aa(1)"); - g_free (text); - - g_object_unref (child); - - g_object_unref (data.descendant); - g_object_unref (builder); - -} - -static AtkObject * -find_root_accessible (GtkTreeView *tv, const char *name) -{ - AtkObject *tvaccessible = gtk_widget_get_accessible (GTK_WIDGET (tv)); - int i = 0; - - for (i = 0;;i++) - { - AtkObject *child = atk_object_ref_accessible_child (tvaccessible, i); - AtkObject *item; - char *text; - if (!child) - return NULL; - item = atk_object_ref_accessible_child (child, 0); - if (!item) - continue; - text = atk_text_get_text (ATK_TEXT (item), 0, -1); - g_object_unref (item); - if (!g_strcmp0 (text, name)) - { - g_free (text); - return child; - } - g_free (text); - g_object_unref (child); - } -} - -static void -test_node_child_of (AtkObject *child, AtkObject *parent) -{ - AtkRelationSet *set = atk_object_ref_relation_set (child); - AtkRelation *relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_NODE_CHILD_OF); - - g_assert (relation != NULL); - g_assert_cmpint (relation->target->len, ==, 1); - g_assert (g_ptr_array_index (relation->target, 0) == parent); - g_object_unref (set); -} - -static void -test_node_parent_of (AtkObject *parent, AtkObject *child) -{ - AtkRelationSet *set = atk_object_ref_relation_set (parent); - AtkRelation *relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_NODE_PARENT_OF); - - g_assert (relation != NULL); - g_assert_cmpint (relation->target->len, ==, 1); - g_assert (g_ptr_array_index (relation->target, 0) == child); - g_object_unref (set); -} - -static void -test_relations (AtkObject *parent, AtkObject *child) -{ - test_node_parent_of (parent, child); - test_node_child_of (child, parent); -} - -static void -test_a11y_tree_relations (void) -{ - GtkBuilder *builder; - GtkWidget *window; - GError *error = NULL; - GtkTreeView *tv; - AtkObject *parent, *child; - - builder = gtk_builder_new (); - gtk_builder_add_from_string (builder, tree_ui, -1, &error); - g_assert_no_error (error); - window = builder_get_toplevel (builder); - g_assert (window); - - populate_tree (builder); - - tv = (GtkTreeView *)gtk_builder_get_object (builder, "treeview1"); - gtk_tree_view_expand_all (tv); - - gtk_widget_show (window); - - parent = find_root_accessible (tv, "a(1)"); -child = find_root_accessible (tv, "aa(1)"); - test_relations (parent, child); - g_object_unref (parent); - parent = child; -child = find_root_accessible (tv, "aaa(1)"); - test_relations (parent, child); - g_object_unref (parent); - g_object_unref (child); - - g_object_unref (builder); - -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv, NULL); - - g_test_add_func ("/a11y/tree/focus", test_a11y_tree_focus); - g_test_add_func ("/a11y/tree/relations", test_a11y_tree_relations); - - return g_test_run (); -} - diff --git a/testsuite/a11y/tree.test.in b/testsuite/a11y/tree.test.in deleted file mode 100644 index d093515472..0000000000 --- a/testsuite/a11y/tree.test.in +++ /dev/null @@ -1,4 +0,0 @@ -[Test] -Exec=@libexecdir@/installed-tests/gtk-4.0/a11y/tree-relationships --tap -k -Type=session -Output=TAP diff --git a/testsuite/a11y/tree.txt b/testsuite/a11y/tree.txt deleted file mode 100644 index eac4f56544..0000000000 --- a/testsuite/a11y/tree.txt +++ /dev/null @@ -1,413 +0,0 @@ -window1 - "frame" - index: 0 - state: enabled resizable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - unnamed-GtkContainerAccessible-0 - "panel" - parent: window1 - state: enabled sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - tv - "table" - parent: window1 - index: 0 - state: enabled focused sensitive showing visible manages-descendants - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkSelection> - selected children: tv - <AtkTable> - rows: 3 - columns: 1 - selected rows: 0 - column 0 description: Test - column 0 header: unnamed-GtkButtonAccessible-1 - table indexes: - ✓✓tv - ✓✓tv - ✓✓tv - unnamed-GtkButtonAccessible-1 - "table column header" - parent: tv - index: 0 - name: Test - state: enabled focusable sensitive showing visible - toolkit: gtk - <AtkComponent> - layer: widget - alpha: 1 - <AtkImage> - image size: -1 x -1 - image description: (null) - <AtkAction> - action 0 name: click - action 0 description: Clicks the button - tv - "table cell" - parent: tv - index: 1 - state: active enabled focusable focused selectable selected sensitive showing transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - tv - "table cell" - parent: tv - index: 0 - name: One - state: active enabled focusable focused selectable selected sensitive showing single-line transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: One - character count: 3 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - tv - "table cell" - parent: tv - index: 1 - name: 234 - state: active enabled focusable focused selectable selected sensitive showing single-line transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: 234 - character count: 3 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - tv - "table cell" - parent: tv - index: 2 - state: enabled focusable selectable sensitive showing transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - position: 1 0 - tv - "table cell" - parent: tv - index: 0 - name: Two - state: enabled focusable selectable sensitive showing single-line transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: Two - character count: 3 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - position: 1 0 - tv - "table cell" - parent: tv - index: 1 - name: 567 - state: enabled focusable selectable sensitive showing single-line transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: 567 - character count: 3 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - position: 1 0 - tv - "table cell" - parent: tv - index: 3 - state: enabled focusable selectable sensitive showing transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - position: 2 0 - tv - "table cell" - parent: tv - index: 0 - name: 40.000 - state: enabled focusable selectable sensitive showing single-line transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: 40.000 - character count: 6 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - position: 2 0 - tv - "table cell" - parent: tv - index: 1 - name: 999999 - state: enabled focusable selectable sensitive showing single-line transient visible - <AtkComponent> - layer: widget - alpha: 1 - <AtkText> - text: 999999 - character count: 6 - caret offset: -1 - default attributes: bg-color: <omitted> - bg-full-height: 0 - editable: false - family-name: <omitted> - fg-color: <omitted> - indent: 0 - invisible: false - justification: left - language: <omitted> - left-margin: 0 - pixels-above-lines: 0 - pixels-below-lines: 0 - pixels-inside-wrap: 0 - right-margin: 0 - rise: 0 - scale: 1 - size: <omitted> - stretch: <omitted> - strikethrough: false - style: <omitted> - underline: none - variant: <omitted> - weight: <omitted> - wrap-mode: word - <AtkAction> - action 0 name: expand or contract - action 0 description: Expands or contracts the row in the tree view containing this cell - action 1 name: edit - action 1 description: Creates a widget in which the contents of the cell can be edited - action 2 name: activate - action 2 description: Activates the cell - <AtkTableCell> - table: tv - column-header[0]: unnamed-GtkButtonAccessible-1 - column-span: 1 - row-span: 1 - position: 2 0 diff --git a/testsuite/a11y/tree.ui b/testsuite/a11y/tree.ui deleted file mode 100644 index eadd2c3e98..0000000000 --- a/testsuite/a11y/tree.ui +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<interface> - <!-- interface-requires gtk+ 3.0 --> - <object class="GtkListStore" id="store"> - <columns> - <column type="gchararray"/> - <column type="gchararray"/> - </columns> - <data> - <row><col id="0">One</col><col id="1">234</col></row> - <row><col id="0">Two</col><col id="1">567</col></row> - <row><col id="0">40.000</col><col id="1">999999</col></row> - </data> - </object> - <object class="GtkWindow" id="window1"> - <child> - <object class="GtkTreeView" id="tv"> - <property name="visible">True</property> - <property name="model">store</property> - <child> - <object class="GtkTreeViewColumn" id="col"> - <property name="title">Test</property> - <property name="visible">True</property> - <child> - <object class="GtkCellRendererText" id="cell1"> - <property name="visible">True</property> - </object> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> - <child> - <object class="GtkCellRendererText" id="cell2"> - <property name="visible">True</property> - </object> - <attributes> - <attribute name="text">1</attribute> - </attributes> - </child> - </object> - </child> - </object> - </child> - </object> -</interface> diff --git a/testsuite/a11y/util.c b/testsuite/a11y/util.c deleted file mode 100644 index c64d2dad9a..0000000000 --- a/testsuite/a11y/util.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2011 Red Hat Inc. - * - * Author: - * Matthias Clasen <mclasen@redhat.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <gtk/gtk.h> - -static void -test_toolkit_name (void) -{ - const char *s; - - s = atk_get_toolkit_name (); - g_assert_cmpstr (s, ==, "gtk"); -} - -static void -test_toolkit_version (void) -{ - const char *s; - - s = atk_get_toolkit_version (); - g_assert_cmpstr (s, ==, GTK_VERSION); -} - -static void -test_root (void) -{ - AtkObject *obj; - - obj = atk_get_root (); - - g_assert (atk_object_get_role (obj) == ATK_ROLE_APPLICATION); - g_assert (atk_object_get_parent (obj) == NULL); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv, NULL); - - g_test_add_func ("/util/toolkit-name", test_toolkit_name); - g_test_add_func ("/util/toolkit-version", test_toolkit_version); - g_test_add_func ("/util/root", test_root); - - return g_test_run (); -} diff --git a/testsuite/a11y/util.test.in b/testsuite/a11y/util.test.in deleted file mode 100644 index 5bab270a87..0000000000 --- a/testsuite/a11y/util.test.in +++ /dev/null @@ -1,4 +0,0 @@ -[Test] -Exec=@libexecdir@/installed-tests/gtk-4.0/a11y/util --tap -k -Type=session -Output=TAP diff --git a/testsuite/a11y/value.c b/testsuite/a11y/value.c deleted file mode 100644 index f43acf933d..0000000000 --- a/testsuite/a11y/value.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2011 Red Hat Inc. - * Copyright (C) 2012 SUSE LLC. - * - * Author: - * Mike Gorse <mgorse@suse.com> - * - * This library 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 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <gtk/gtk.h> -#include <string.h> - -static void -set_value (GtkWidget *widget, - int value) -{ - if (GTK_IS_LEVEL_BAR (widget)) - gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), value); - else if (GTK_IS_RANGE (widget)) - { - GtkAdjustment *adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - gtk_adjustment_set_value (adjustment, value); - } - else if (GTK_IS_SPIN_BUTTON (widget)) - { - GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - gtk_adjustment_set_value (adjustment, value); - } -} - -typedef struct -{ - int count; - char *last_name; -} NotifyData; - -static void -notify_cb (GObject *obj, - GParamSpec *pspec, NotifyData *data) -{ - data->count++; - g_free (data->last_name); - data->last_name = g_strdup (pspec->name); -} - -static void -test_basic (GtkWidget *widget) -{ - NotifyData notify_data; - AtkObject *atk_object; - AtkValue *atk_value; - double value = 50; - double ret; - char *text; - - atk_object = gtk_widget_get_accessible (widget); - atk_value = ATK_VALUE (atk_object); - - memset (¬ify_data, 0, sizeof (notify_data)); - g_signal_connect (atk_object, "notify", G_CALLBACK (notify_cb), ¬ify_data); - set_value (widget, value); - g_assert_cmpint (notify_data.count, ==, 1); - g_assert_cmpstr (notify_data.last_name, ==, "accessible-value"); - - text = NULL; - atk_value_get_value_and_text (atk_value, &ret, &text); - g_assert_cmpfloat (ret, ==, value); - g_free (text); - - g_free (notify_data.last_name); - g_signal_handlers_disconnect_by_func (atk_object, G_CALLBACK (notify_cb), ¬ify_data); -} - -static void -setup_test (GtkWidget *widget) -{ - set_value (widget, 0); -} - -static void -add_value_test (const char *prefix, - GTestFixtureFunc test_func, - GtkWidget *widget) -{ - char *path; - - path = g_strdup_printf ("%s/%s", prefix, G_OBJECT_TYPE_NAME (widget)); - g_test_add_vtable (path, - 0, - g_object_ref (widget), - (GTestFixtureFunc) setup_test, - (GTestFixtureFunc) test_func, - (GTestFixtureFunc) g_object_unref); - g_free (path); -} - -static void -add_value_tests (GtkWidget *widget) -{ - g_object_ref_sink (widget); - add_value_test ("/value/basic", (GTestFixtureFunc) test_basic, widget); - g_object_unref (widget); -} - -int -main (int argc, char *argv[]) -{ - gtk_test_init (&argc, &argv, NULL); - - add_value_tests (gtk_spin_button_new_with_range (0, 100, 1)); - add_value_tests (gtk_level_bar_new_for_interval (0, 100)); - - return g_test_run (); -} diff --git a/testsuite/a11y/value.test.in b/testsuite/a11y/value.test.in deleted file mode 100644 index 08f1e31fb6..0000000000 --- a/testsuite/a11y/value.test.in +++ /dev/null @@ -1,4 +0,0 @@ -[Test] -Exec=@libexecdir@/installed-tests/gtk-4.0/a11y/value --tap -k -Type=session -Output=TAP diff --git a/testsuite/css/nodes/buttons.ui b/testsuite/css/nodes/buttons.ui index 65151e9b69..3b89c6dd60 100644 --- a/testsuite/css/nodes/buttons.ui +++ b/testsuite/css/nodes/buttons.ui @@ -66,11 +66,6 @@ <object class="GtkSwitch" id="button6"> <property name="can_focus">1</property> <property name="receives_default">1</property> - <child internal-child="accessible"> - <object class="AtkObject" id="button6-accessible"> - <property name="accessible-name">Test switch</property> - </object> - </child> <layout> <property name="left_attach">5</property> <property name="top_attach">0</property> diff --git a/testsuite/gtk/accessible.c b/testsuite/gtk/accessible.c deleted file mode 100644 index 5671e536a4..0000000000 --- a/testsuite/gtk/accessible.c +++ /dev/null @@ -1,49 +0,0 @@ -#include <gtk/gtk.h> - -static void -test_type (gconstpointer data) -{ - GType t = *(GType *)data; - GtkWidget *w; - AtkObject *a; - - w = (GtkWidget *)g_object_new (t, NULL); - if (g_type_is_a (t, G_TYPE_INITIALLY_UNOWNED)) - g_object_ref_sink (w); - - a = gtk_widget_get_accessible (w); - - g_assert (GTK_IS_ACCESSIBLE (a)); - g_assert (gtk_accessible_get_widget (GTK_ACCESSIBLE (a)) == w); - - g_object_unref (w); -} - -int -main (int argc, char *argv[]) -{ - const GType *tp; - guint i, n; - - gtk_test_init (&argc, &argv, NULL); - gtk_test_register_all_types (); - - tp = gtk_test_list_all_types (&n); - - for (i = 0; i < n; i++) - { - char *testname; - - if (!g_type_is_a (tp[i], GTK_TYPE_WIDGET) || - G_TYPE_IS_ABSTRACT (tp[i]) || - !G_TYPE_IS_INSTANTIATABLE (tp[i])) - continue; - - testname = g_strdup_printf ("/Accessible/%s", g_type_name (tp[i])); - g_test_add_data_func (testname, &tp[i], test_type); - - g_free (testname); - } - - return g_test_run (); -} diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c index 8d8f9e3d01..6e514d4e55 100644 --- a/testsuite/gtk/builder.c +++ b/testsuite/gtk/builder.c @@ -1432,22 +1432,10 @@ test_widget (void) " <property name=\"orientation\">vertical</property>" " <child>" " <object class=\"GtkLabel\" id=\"label1\">" - " <child internal-child=\"accessible\">" - " <object class=\"AtkObject\" id=\"a11y-label1\">" - " <property name=\"AtkObject::accessible-name\">A Label</property>" - " </object>" - " </child>" - " <accessibility>" - " <relation target=\"button1\" type=\"label-for\"/>" - " </accessibility>" " </object>" " </child>" " <child>" " <object class=\"GtkButton\" id=\"button1\">" - " <accessibility>" - " <action action_name=\"click\" description=\"Sliff\"/>" - " <action action_name=\"clack\" translatable=\"yes\">Sniff</action>" - " </accessibility>" " </object>" " </child>" " </object>" @@ -1460,19 +1448,12 @@ test_widget (void) " <child>" " <object class=\"GtkLabel\" id=\"label1\">" " <property name=\"label\">Thelabel</property>" - " <accessibility>" - " <role type=\"static\"/>" - " </accessibility>" " </object>" " </child>" " </object>" "</interface>"; GtkBuilder *builder; GObject *window1, *button1, *label1; - AtkObject *accessible; - AtkRelationSet *relation_set; - AtkRelation *relation; - char *name; builder = builder_new_from_string (buffer, -1, NULL); button1 = gtk_builder_get_object (builder, "button1"); @@ -1494,28 +1475,14 @@ test_widget (void) window1 = gtk_builder_get_object (builder, "window1"); label1 = gtk_builder_get_object (builder, "label1"); + g_assert (GTK_IS_LABEL (label1)); - accessible = gtk_widget_get_accessible (GTK_WIDGET (label1)); - relation_set = atk_object_ref_relation_set (accessible); - g_assert_cmpint (atk_relation_set_get_n_relations (relation_set), ==, 1); - relation = atk_relation_set_get_relation (relation_set, 0); - g_assert (relation != NULL); - g_assert_true (ATK_IS_RELATION (relation)); - g_assert_cmpint (atk_relation_get_relation_type (relation), !=, ATK_RELATION_LABELLED_BY); - g_object_unref (relation_set); - - g_object_get (G_OBJECT (accessible), "accessible-name", &name, NULL); - g_assert_cmpstr (name, ==, "A Label"); - g_free (name); - gtk_window_destroy (GTK_WINDOW (window1)); g_object_unref (builder); builder = builder_new_from_string (buffer4, -1, NULL); label1 = gtk_builder_get_object (builder, "label1"); - - accessible = gtk_widget_get_accessible (GTK_WIDGET (label1)); - g_assert (atk_object_get_role (accessible) == ATK_ROLE_STATIC); + g_assert (GTK_IS_LABEL (label1)); g_object_unref (builder); } diff --git a/testsuite/gtk/focus-chain/widget-factory.ui b/testsuite/gtk/focus-chain/widget-factory.ui index ff594c9eca..bf09b8732b 100644 --- a/testsuite/gtk/focus-chain/widget-factory.ui +++ b/testsuite/gtk/focus-chain/widget-factory.ui @@ -2908,9 +2908,6 @@ bad things might happen.</property> <property name="margin-top">20</property> <property name="margin-bottom">20</property> <property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> @@ -3110,9 +3107,6 @@ bad things might happen.</property> <object class="GtkLabel" id="title_label"> <property name="label">Title:</property> <property name="xalign">1</property> - <accessibility> - <relation type="label-for" target="open_popover_entry"/> - </accessibility> </object> </child> <child> @@ -3120,9 +3114,6 @@ bad things might happen.</property> <property name="valign">start</property> <property name="label">Description:</property> <property name="xalign">1</property> - <accessibility> - <relation type="label-for" target="open_popover_textview"/> - </accessibility> <layout> <property name="top-attach">1</property> </layout> @@ -3138,9 +3129,6 @@ bad things might happen.</property> <property name="max-content-width">100</property> <child> <object class="GtkTextView" id="open_popover_textview"> - <accessibility> - <relation type="labelled-by" target="description_label"/> - </accessibility> </object> </child> <layout> @@ -3153,9 +3141,6 @@ bad things might happen.</property> <child> <object class="GtkEntry" id="open_popover_entry"> <property name="activates-default">1</property> - <accessibility> - <relation type="labelled-by" target="title_label"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="column-span">2</property> @@ -3234,9 +3219,6 @@ bad things might happen.</property> <child> <object class="GtkLabel"> <property name="label">No updates at this time</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> @@ -3245,9 +3227,6 @@ bad things might happen.</property> <child> <object class="GtkLabel"> <property name="label">You're in too deep!</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> diff --git a/testsuite/gtk/focus-chain/widget-factory2.ui b/testsuite/gtk/focus-chain/widget-factory2.ui index f0456fb3ed..abe48c0222 100644 --- a/testsuite/gtk/focus-chain/widget-factory2.ui +++ b/testsuite/gtk/focus-chain/widget-factory2.ui @@ -2909,9 +2909,6 @@ bad things might happen.</property> <property name="margin-top">20</property> <property name="margin-bottom">20</property> <property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> @@ -3111,9 +3108,6 @@ bad things might happen.</property> <object class="GtkLabel" id="title_label"> <property name="label">Title:</property> <property name="xalign">1</property> - <accessibility> - <relation type="label-for" target="open_popover_entry"/> - </accessibility> </object> </child> <child> @@ -3121,9 +3115,6 @@ bad things might happen.</property> <property name="valign">start</property> <property name="label">Description:</property> <property name="xalign">1</property> - <accessibility> - <relation type="label-for" target="open_popover_textview"/> - </accessibility> <layout> <property name="top-attach">1</property> </layout> @@ -3139,9 +3130,6 @@ bad things might happen.</property> <property name="max-content-width">100</property> <child> <object class="GtkTextView" id="open_popover_textview"> - <accessibility> - <relation type="labelled-by" target="description_label"/> - </accessibility> </object> </child> <layout> @@ -3154,9 +3142,6 @@ bad things might happen.</property> <child> <object class="GtkEntry" id="open_popover_entry"> <property name="activates-default">1</property> - <accessibility> - <relation type="labelled-by" target="title_label"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="column-span">2</property> @@ -3235,9 +3220,6 @@ bad things might happen.</property> <child> <object class="GtkLabel"> <property name="label">No updates at this time</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> @@ -3246,9 +3228,6 @@ bad things might happen.</property> <child> <object class="GtkLabel"> <property name="label">You're in too deep!</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> diff --git a/testsuite/gtk/focus-chain/widget-factory3.ui b/testsuite/gtk/focus-chain/widget-factory3.ui index c4e4b679c3..02c485c4b7 100644 --- a/testsuite/gtk/focus-chain/widget-factory3.ui +++ b/testsuite/gtk/focus-chain/widget-factory3.ui @@ -2909,9 +2909,6 @@ bad things might happen.</property> <property name="margin-top">20</property> <property name="margin-bottom">20</property> <property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> @@ -3111,9 +3108,6 @@ bad things might happen.</property> <object class="GtkLabel" id="title_label"> <property name="label">Title:</property> <property name="xalign">1</property> - <accessibility> - <relation type="label-for" target="open_popover_entry"/> - </accessibility> </object> </child> <child> @@ -3121,9 +3115,6 @@ bad things might happen.</property> <property name="valign">start</property> <property name="label">Description:</property> <property name="xalign">1</property> - <accessibility> - <relation type="label-for" target="open_popover_textview"/> - </accessibility> <layout> <property name="top-attach">1</property> </layout> @@ -3139,9 +3130,6 @@ bad things might happen.</property> <property name="max-content-width">100</property> <child> <object class="GtkTextView" id="open_popover_textview"> - <accessibility> - <relation type="labelled-by" target="description_label"/> - </accessibility> </object> </child> <layout> @@ -3154,9 +3142,6 @@ bad things might happen.</property> <child> <object class="GtkEntry" id="open_popover_entry"> <property name="activates-default">1</property> - <accessibility> - <relation type="labelled-by" target="title_label"/> - </accessibility> <layout> <property name="left-attach">1</property> <property name="column-span">2</property> @@ -3235,9 +3220,6 @@ bad things might happen.</property> <child> <object class="GtkLabel"> <property name="label">No updates at this time</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> @@ -3246,9 +3228,6 @@ bad things might happen.</property> <child> <object class="GtkLabel"> <property name="label">You're in too deep!</property> - <accessibility> - <role type="static"/> - </accessibility> </object> </child> </object> diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build index f5815ea210..5063bb474f 100644 --- a/testsuite/gtk/meson.build +++ b/testsuite/gtk/meson.build @@ -21,7 +21,6 @@ endif # - 'suites': (array): additional test suites tests = [ { 'name': 'accel' }, - { 'name': 'accessible' }, { 'name': 'action' }, { 'name': 'adjustment' }, { 'name': 'bitset' }, diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c index dda0f22d2b..58527375cf 100644 --- a/testsuite/gtk/notify.c +++ b/testsuite/gtk/notify.c @@ -373,8 +373,7 @@ test_type (gconstpointer data) return; /* non-GTK+ */ - if (g_str_equal (g_type_name (type), "AtkObject") || - g_str_equal (g_type_name (type), "GdkPixbufSimpleAnim")) + if (g_str_equal (g_type_name (type), "GdkPixbufSimpleAnim")) return; /* Deprecated, not getting fixed */ @@ -505,8 +504,7 @@ test_type (gconstpointer data) continue; /* non-GTK+ */ - if (g_str_equal (g_type_name (pspec->owner_type), "AtkObject") || - g_str_equal (g_type_name (pspec->owner_type), "GdkPixbufSimpleAnim") || + if (g_str_equal (g_type_name (pspec->owner_type), "GdkPixbufSimpleAnim") || g_str_equal (g_type_name (pspec->owner_type), "GMountOperation")) continue; diff --git a/testsuite/meson.build b/testsuite/meson.build index 47ce9a6134..64961f5dc7 100644 --- a/testsuite/meson.build +++ b/testsuite/meson.build @@ -42,6 +42,5 @@ subdir('gdk') subdir('gsk') subdir('gtk') subdir('css') -#subdir('a11y') subdir('tools') subdir('reftests') diff --git a/testsuite/tools/simplify-data-3to4/grid.expected b/testsuite/tools/simplify-data-3to4/grid.expected index 5005cc0725..f14ad0d248 100644 --- a/testsuite/tools/simplify-data-3to4/grid.expected +++ b/testsuite/tools/simplify-data-3to4/grid.expected @@ -65,11 +65,6 @@ <child> <object class="GtkSwitch" id="button6"> <property name="receives_default">1</property> - <child internal-child="accessible"> - <object class="AtkObject" id="button6-accessible"> - <property name="accessible-name">Test switch</property> - </object> - </child> <layout> <property name="left_attach">5</property> <property name="top_attach">0</property> diff --git a/testsuite/tools/simplify-data-3to4/grid.ui b/testsuite/tools/simplify-data-3to4/grid.ui index 29a723c0a7..30c0314937 100644 --- a/testsuite/tools/simplify-data-3to4/grid.ui +++ b/testsuite/tools/simplify-data-3to4/grid.ui @@ -75,11 +75,6 @@ <property name="active">False</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="button6-accessible"> - <property name="accessible-name">Test switch</property> - </object> - </child> </object> <packing> <property name="left_attach">5</property> |