static DBusMessage * impl_GetPosition (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkComponent *component = (AtkComponent *) user_data; DBusError error; dbus_uint32_t coord_type; gint ix = 0, iy = 0; dbus_int32_t x, y; DBusMessage *reply; g_return_val_if_fail (ATK_IS_COMPONENT (user_data), droute_not_yet_handled_error (message)); dbus_error_init (&error); if (!dbus_message_get_args (message, &error, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID)) { return droute_invalid_arguments_error (message); } atk_component_get_position (component, &ix, &iy, (AtkCoordType) coord_type); x = ix; y = iy; reply = dbus_message_new_method_return (message); if (reply) { dbus_message_append_args (reply, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INVALID); } return reply; }
static void eti_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type) { ETableItem *item; AtkObject *parent; item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (component))); if (!item) return; parent = ATK_OBJECT (component)->accessible_parent; if (parent && ATK_IS_COMPONENT (parent)) atk_component_get_extents ( ATK_COMPONENT (parent), x, y, width, height, coord_type); if (parent && GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD (parent)) { ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD ( atk_gobject_accessible_get_object ( ATK_GOBJECT_ACCESSIBLE (parent))); if (etcta) { *width = etcta->width; *height = etcta->height; } } }
AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) { if (!ATK_IS_COMPONENT(m_element)) return 0; return AccessibilityUIElement(atk_component_ref_accessible_at_point(ATK_COMPONENT(m_element), x, y, ATK_XY_WINDOW)); }
static DBusMessage * impl_GetAccessibleAtPoint (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkComponent *component = (AtkComponent *) user_data; dbus_int32_t x, y; dbus_uint32_t coord_type; DBusMessage *reply; DBusError error; AtkObject *child; g_return_val_if_fail (ATK_IS_COMPONENT (user_data), droute_not_yet_handled_error (message)); dbus_error_init (&error); if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID)) { return droute_invalid_arguments_error (message); } child = atk_component_ref_accessible_at_point (component, x, y, (AtkCoordType) coord_type); reply = spi_object_return_reference (message, child); g_object_unref (child); return reply; }
static DBusMessage * impl_Embedded (DBusConnection *bus, DBusMessage *message, void *user_data) { AtkObject *object = (AtkObject *) user_data; char *path; gchar *id; if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID)) { return droute_invalid_arguments_error (message); } id = g_strconcat (dbus_message_get_sender (message), ":", path, NULL); g_object_set_data_full (G_OBJECT (object), "dbus-plug-parent", id, (GDestroyNotify)g_free); if (ATK_IS_COMPONENT (object)) { AtkComponent *component = ATK_COMPONENT (object); AtkComponentIface *iface = ATK_COMPONENT_GET_IFACE (component); iface->get_extents = atspi_plug_component_get_extents; iface->get_size = atspi_plug_component_get_size; iface->get_position = atspi_plug_component_get_position; } /* Retrieve some info about the children, if they exist, when embedding the plug to ensure the a11y subtree is generated. https://bugzilla.gnome.org/show_bug.cgi?id=663876 */ atk_object_get_n_accessible_children (object); return dbus_message_new_method_return (message); }
static DBusMessage * impl_contains (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkComponent *component = (AtkComponent *) user_data; dbus_int32_t x, y; dbus_uint32_t coord_type; DBusError error; dbus_bool_t retval; DBusMessage *reply; g_return_val_if_fail (ATK_IS_COMPONENT (user_data), droute_not_yet_handled_error (message)); dbus_error_init (&error); if (!dbus_message_get_args (message, &error, DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID)) { return droute_invalid_arguments_error (message); } retval = atk_component_contains (component, x, y, (AtkCoordType) coord_type); reply = dbus_message_new_method_return (message); if (reply) { dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &retval, DBUS_TYPE_INVALID); } return reply; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::elementAtPoint(int x, int y) { if (!ATK_IS_COMPONENT(m_element.get())) return nullptr; GRefPtr<AtkObject> objectAtPoint = adoptGRef(atk_component_ref_accessible_at_point(ATK_COMPONENT(m_element.get()), x, y, ATK_XY_WINDOW)); return AccessibilityUIElement::create(objectAtPoint ? objectAtPoint.get() : m_element.get()); }
double AccessibilityUIElement::height() { if (!ATK_IS_COMPONENT(m_element.get())) return 0; int width, height; atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height); return height; }
double AccessibilityUIElement::y() { if (!ATK_IS_COMPONENT(m_element.get())) return 0; int x, y; atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_SCREEN); return y; }
double AccessibilityUIElement::clickPointY() { if (!ATK_IS_COMPONENT(m_element.get())) return 0; int x, y; atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_WINDOW); int width, height; atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height); return y + height / 2.0; }
static DBusMessage * impl_GetLayer (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkComponent *component = (AtkComponent *) user_data; AtkLayer atklayer; dbus_uint32_t rv; DBusMessage *reply; g_return_val_if_fail (ATK_IS_COMPONENT (user_data), droute_not_yet_handled_error (message)); atklayer = atk_component_get_layer (component); switch (atklayer) { case ATK_LAYER_BACKGROUND: rv = Accessibility_LAYER_BACKGROUND; break; case ATK_LAYER_CANVAS: rv = Accessibility_LAYER_CANVAS; break; case ATK_LAYER_WIDGET: rv = Accessibility_LAYER_WIDGET; break; case ATK_LAYER_MDI: rv = Accessibility_LAYER_MDI; break; case ATK_LAYER_POPUP: rv = Accessibility_LAYER_POPUP; break; case ATK_LAYER_OVERLAY: rv = Accessibility_LAYER_OVERLAY; break; case ATK_LAYER_WINDOW: rv = Accessibility_LAYER_WINDOW; break; default: rv = Accessibility_LAYER_INVALID; break; } reply = dbus_message_new_method_return (message); if (reply) { dbus_message_append_args (reply, DBUS_TYPE_UINT32, &rv, DBUS_TYPE_INVALID); } return reply; }
/* Translate GtkWidget::size-allocate to AtkComponent::bounds-changed */ static void size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation) { AtkObject* accessible; AtkRectangle rect; accessible = gtk_widget_get_accessible (widget); if (ATK_IS_COMPONENT (accessible)) { rect.x = allocation->x; rect.y = allocation->y; rect.width = allocation->width; rect.height = allocation->height; g_signal_emit_by_name (accessible, "bounds-changed", &rect); } }
static DBusMessage * impl_GetAlpha (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkComponent *component = (AtkComponent *) user_data; double rv; DBusMessage *reply; g_return_val_if_fail (ATK_IS_COMPONENT (user_data), droute_not_yet_handled_error (message)); rv = atk_component_get_alpha (component); reply = dbus_message_new_method_return (message); if (reply) { dbus_message_append_args (reply, DBUS_TYPE_DOUBLE, &rv, DBUS_TYPE_INVALID); } return reply; }
static DBusMessage * impl_GetExtents (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkComponent *component = (AtkComponent *) user_data; DBusError error; dbus_uint32_t coord_type; gint ix, iy, iwidth, iheight; g_return_val_if_fail (ATK_IS_COMPONENT (user_data), droute_not_yet_handled_error (message)); dbus_error_init (&error); if (!dbus_message_get_args (message, &error, DBUS_TYPE_UINT32, &coord_type, DBUS_TYPE_INVALID)) { return droute_invalid_arguments_error (message); } atk_component_get_extents (component, &ix, &iy, &iwidth, &iheight, (AtkCoordType) coord_type); return spi_dbus_return_rect (message, ix, iy, iwidth, iheight); }
static void _test_focus_on_entry(AtkObject *obj) { AtkObject *focused_obj = NULL; gboolean success = FALSE; _printf("Testing focus....\n"); /* changing focus */ g_assert(ATK_IS_COMPONENT(obj)); success = atk_component_grab_focus(ATK_COMPONENT(obj)); g_assert(success); /* now focus should point to our button*/ focused_obj = atk_get_focus_object(); g_assert(focused_obj); g_assert(focused_obj == obj); _printf("DONE. All focus test passed successfully \n"); eail_test_code_called = TRUE; }
static DBusMessage * impl_GetSize (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkComponent *component = (AtkComponent *) user_data; gint iwidth = 0, iheight = 0; dbus_int32_t width, height; DBusMessage *reply; g_return_val_if_fail (ATK_IS_COMPONENT (user_data), droute_not_yet_handled_error (message)); atk_component_get_size (component, &iwidth, &iheight); width = iwidth; height = iheight; reply = dbus_message_new_method_return (message); if (reply) { dbus_message_append_args (reply, DBUS_TYPE_INT32, &width, DBUS_TYPE_INT32, &height, DBUS_TYPE_INVALID); } return reply; }
SpiAccessible * spi_accessible_construct (GType type, AtkObject *o) { SpiAccessible *retval; CORBA_Environment ev; CORBA_exception_init (&ev); g_assert (o); g_assert (g_type_is_a (type, SPI_ACCESSIBLE_TYPE)); if ((retval = g_hash_table_lookup (get_public_refs (), o))) { bonobo_object_ref (BONOBO_OBJECT (retval)); return retval; } else { retval = g_object_new (type, NULL); spi_base_construct (SPI_BASE (retval), G_OBJECT(o)); } g_hash_table_insert (get_public_refs (), o, retval); g_signal_connect (G_OBJECT (retval), "destroy", G_CALLBACK (de_register_public_ref), NULL); /* aggregate appropriate SPI interfaces based on ATK interfaces */ if (ATK_IS_ACTION (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_action_interface_new (o))); } if (ATK_IS_COMPONENT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_component_interface_new (o))); } if (ATK_IS_EDITABLE_TEXT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT(spi_editable_text_interface_new (o))); } else if (ATK_IS_TEXT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_text_interface_new (o))); } if (ATK_IS_HYPERTEXT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_hypertext_interface_new (o))); } if (ATK_IS_IMAGE (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_image_interface_new (o))); } if (ATK_IS_SELECTION (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_selection_interface_new (o))); } if (ATK_IS_TABLE (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_table_interface_new (o))); } if (ATK_IS_VALUE (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_value_interface_new (o))); } if (ATK_IS_STREAMABLE_CONTENT (o)) { bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_streamable_interface_new (o))); } if (ATK_IS_DOCUMENT (o)) /* We add collection interface to document */ { SpiDocument *doc = spi_document_interface_new (o); bonobo_object_add_interface (BONOBO_OBJECT (doc), BONOBO_OBJECT (spi_collection_interface_new (o))); bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (doc)); } if (ATK_IS_HYPERLINK_IMPL (o)) { /* !!! the cast below is used instead of the ATK_HYPERLINK macro, since the object 'o' is not really a hyperlink, but is in fact an AtkHyperlinkImpl. Ouch. This works since it gets cast back to GObject, but it's nasty and needs to be cleaned up. */ bonobo_object_add_interface (bonobo_object (retval), BONOBO_OBJECT (spi_hyperlink_new ((AtkHyperlink*)o))); } return retval; }