summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPadraig O'Briain <padraigo@src.gnome.org>2001-05-16 08:12:24 +0000
committerPadraig O'Briain <padraigo@src.gnome.org>2001-05-16 08:12:24 +0000
commit6b3b6187b1309f47d6af7da85ee4455f70a73b92 (patch)
tree012cbc4cf00037ed8e7d1460ba2aaa276dbcd98a
parenta09abab445274bc8d3187c10150bb201031d0a48 (diff)
downloadatk-6b3b6187b1309f47d6af7da85ee4455f70a73b92.tar.gz
Provide default implementation for atk_component_get_accessible_at_point().
Correct errors in atk_component_get_accessible_at_point()
-rwxr-xr-xatk/atkcomponent.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/atk/atkcomponent.c b/atk/atkcomponent.c
index f7a0ea4..3d024bc 100755
--- a/atk/atkcomponent.c
+++ b/atk/atkcomponent.c
@@ -20,6 +20,10 @@
#include "atkcomponent.h"
+static AtkObject* atk_component_real_get_accessible_at_point (AtkComponent *component,
+ gint x,
+ gint y);
+
GType
atk_component_get_type ()
{
@@ -99,15 +103,20 @@ atk_component_get_accessible_at_point (AtkComponent *component,
gint y)
{
AtkComponentIface *iface = NULL;
- g_return_val_if_fail (component != NULL, FALSE);
- g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);
+ g_return_val_if_fail (component != NULL, NULL);
+ g_return_val_if_fail (ATK_IS_COMPONENT (component), NULL);
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->get_accessible_at_point)
return (iface->get_accessible_at_point) (component, x, y);
else
- return FALSE;
+ {
+ /*
+ * if this method is not overridden use the default implementation.
+ */
+ return atk_component_real_get_accessible_at_point (component, x, y);
+ }
}
void
@@ -231,3 +240,36 @@ atk_component_set_size (AtkComponent *component,
if (iface->set_size)
(iface->set_size) (component, x, y);
}
+
+static AtkObject*
+atk_component_real_get_accessible_at_point (AtkComponent *component,
+ gint x,
+ gint y)
+{
+ gint count, i;
+
+ count = atk_object_get_n_accessible_children (ATK_OBJECT (component));
+
+ g_return_val_if_fail (count != 0, NULL);
+
+ for (i = 0; i < count; i++)
+ {
+ AtkObject *obj;
+
+ obj = atk_object_ref_accessible_child (ATK_OBJECT (component), i);
+
+ if (obj != NULL)
+ {
+ if (atk_component_contains (ATK_COMPONENT (obj), x, y))
+ {
+ g_object_unref (obj);
+ return obj;
+ }
+ else
+ {
+ g_object_unref (obj);
+ }
+ }
+ }
+ return NULL;
+}