* Get the application instance's unique ID as assigned by the registry.
*
**/
- attribute string id;
+ attribute long id;
/**
* Register with this application's toolkit for "toolkit" event notifications.
* Get the application instance's unique ID as assigned by the registry.
*
**/
- attribute string id;
+ attribute long id;
/**
* Register with this application's toolkit for "toolkit" event notifications.
return retval;
}
-static CORBA_string
+static CORBA_long
impl_accessibility_application_get_id (PortableServer_Servant servant,
- CORBA_Environment *ev)
+ CORBA_Environment *ev)
{
- CORBA_char *retval;
+ CORBA_long retval;
Application *application = APPLICATION (bonobo_object_from_servant (servant));
- retval = CORBA_string_dup (application->id);
+ retval = (CORBA_long) application->id;
return retval;
}
static void
impl_accessibility_application_set_id (PortableServer_Servant servant,
- const CORBA_char *id,
+ const CORBA_long id,
CORBA_Environment *ev)
{
Application *application = APPLICATION (bonobo_object_from_servant (servant));
typedef struct {
Accessible parent;
- char *id;
+ long id;
} Application;
typedef struct {
} ApplicationClass;
GType application_get_type (void);
-gboolean *application_set_id (AtkObject *app, char *id);
+gboolean *application_set_id (AtkObject *app, long id);
Application *application_new (AtkObject *app_root);
* This pulls the definition for the BonoboObject (Gtk Type)
*/
#include "component.h"
+#include "accessible.h"
/*
* Our parent Gtk object type
return retval;
}
+/*
+ * CORBA Accessibility::Component::getAccessibleAtPoint method implementation
+ */
+static Accessibility_Accessible
+impl_accessibility_component_get_accessible_at_point (PortableServer_Servant servant,
+ const CORBA_long x,
+ const CORBA_long y,
+ CORBA_short coord_type,
+ CORBA_Environment *ev)
+{
+ Accessibility_Accessible retval;
+ Component *component = COMPONENT (bonobo_object_from_servant (servant));
+ AtkObject *child;
+ child = atk_component_ref_accessible_at_point (ATK_COMPONENT (component->atko),
+ (gint) x, (gint) y,
+ (AtkCoordType) coord_type);
+ retval = bonobo_object_corba_objref (bonobo_object (accessible_new (child)));
+ return retval;
+}
+
+/*
+ * CORBA Accessibility::Component::getExtents method implementation
+ */
+static void
+impl_accessibility_component_get_extents (PortableServer_Servant servant,
+ CORBA_long * x,
+ CORBA_long * y,
+ CORBA_long * width,
+ CORBA_long * height,
+ const CORBA_short coord_type,
+ CORBA_Environment *ev)
+{
+ Component *component = COMPONENT (bonobo_object_from_servant (servant));
+ gint ix, iy, iw, ih;
+ atk_component_get_extents (ATK_COMPONENT (component->atko), &ix, &iy, &iw, &ih,
+ (AtkCoordType) coord_type);
+ *x = (CORBA_long) ix;
+ *y = (CORBA_long) iy;
+ *width = (CORBA_long) iw;
+ *height = (CORBA_long) ih;
+}
+
+/*
+ * CORBA Accessibility::Component::getPosition method implementation
+ */
+static void
+impl_accessibility_component_get_position (PortableServer_Servant servant,
+ CORBA_long * x,
+ CORBA_long * y,
+ const CORBA_short coord_type,
+ CORBA_Environment *ev)
+{
+ Component *component = COMPONENT (bonobo_object_from_servant (servant));
+ gint ix, iy;
+ atk_component_get_position (ATK_COMPONENT (component->atko), &ix, &iy,
+ (AtkCoordType) coord_type);
+ *x = (CORBA_long) ix;
+ *y = (CORBA_long) iy;
+}
+
+/*
+ * CORBA Accessibility::Component::getSize method implementation
+ */
+static void
+impl_accessibility_component_get_size (PortableServer_Servant servant,
+ CORBA_long * width,
+ CORBA_long * height,
+ CORBA_Environment *ev)
+{
+ Component *component = COMPONENT (bonobo_object_from_servant (servant));
+ gint iw, ih;
+ atk_component_get_size (ATK_COMPONENT (component->atko), &iw, &ih);
+ *width = (CORBA_long) iw;
+ *height = (CORBA_long) ih;
+}
+
static void
accessibility_component_class_init (ComponentClass *klass)
{
object_class->finalize = accessibility_component_object_finalize;
epv->contains = impl_accessibility_component_contains;
+ epv->getAccessibleAtPoint = impl_accessibility_component_get_accessible_at_point;
+ epv->getExtents = impl_accessibility_component_get_extents;
+ epv->getPosition = impl_accessibility_component_get_position;
+ epv->getSize = impl_accessibility_component_get_size;
}
static void
CORBA_exception_id(ev));
exit(-1);
}
+ /*
fprintf (stderr, "source is component ? : %s\n",
Accessibility_Accessible_queryInterface (e->source,
"IDL:Accessibility/Component:1.0",
ev)
? "yes" : "no");
-
+ */
+ /* TODO: free/deref the returned interface! */
#endif
bonobo_object_release_unref (e->source, ev);
} ListenerStruct;
/* static function prototypes */
-static void registry_notify_listeners ( GList *listeners,
+static void _registry_notify_listeners ( GList *listeners,
const Accessibility_Event *e,
CORBA_Environment *ev);
+static long _get_unique_id();
+
/*
* Implemented GObject::finalize
*/
registry->desktop->applications = g_list_append (registry->desktop->applications,
CORBA_Object_duplicate (application, ev));
- /* TODO: create unique string here (with libuuid call ?) */
- Accessibility_Application__set_id (application, "test-some-unique-string", ev);
+ /* TODO: create unique string here (with libuuid call ?) and hash ? */
+ Accessibility_Application__set_id (application, _get_unique_id(), ev);
/*
* TODO: change the implementation below to a WM-aware one;
switch (etype.type_cat)
{
case (ETYPE_FOCUS) :
- registry_notify_listeners (registry->focus_listeners, e, ev);
+ _registry_notify_listeners (registry->focus_listeners, e, ev);
break;
case (ETYPE_WINDOW) :
- registry_notify_listeners (registry->window_listeners, e, ev);
+ _registry_notify_listeners (registry->window_listeners, e, ev);
break;
case (ETYPE_TOOLKIT) :
- registry_notify_listeners (registry->toolkit_listeners, e, ev);
+ _registry_notify_listeners (registry->toolkit_listeners, e, ev);
break;
default:
break;
bonobo_object_release_unref (e->source, ev);
}
+static long
+_get_unique_id ()
+{
+ static long id = 0;
+ return ++id;
+}
+
static void
-registry_notify_listeners ( GList *listeners,
+_registry_notify_listeners ( GList *listeners,
const Accessibility_Event *e,
CORBA_Environment *ev)
{
} ListenerStruct;
/* static function prototypes */
-static void registry_notify_listeners ( GList *listeners,
+static void _registry_notify_listeners ( GList *listeners,
const Accessibility_Event *e,
CORBA_Environment *ev);
+static long _get_unique_id();
+
/*
* Implemented GObject::finalize
*/
registry->desktop->applications = g_list_append (registry->desktop->applications,
CORBA_Object_duplicate (application, ev));
- /* TODO: create unique string here (with libuuid call ?) */
- Accessibility_Application__set_id (application, "test-some-unique-string", ev);
+ /* TODO: create unique string here (with libuuid call ?) and hash ? */
+ Accessibility_Application__set_id (application, _get_unique_id(), ev);
/*
* TODO: change the implementation below to a WM-aware one;
switch (etype.type_cat)
{
case (ETYPE_FOCUS) :
- registry_notify_listeners (registry->focus_listeners, e, ev);
+ _registry_notify_listeners (registry->focus_listeners, e, ev);
break;
case (ETYPE_WINDOW) :
- registry_notify_listeners (registry->window_listeners, e, ev);
+ _registry_notify_listeners (registry->window_listeners, e, ev);
break;
case (ETYPE_TOOLKIT) :
- registry_notify_listeners (registry->toolkit_listeners, e, ev);
+ _registry_notify_listeners (registry->toolkit_listeners, e, ev);
break;
default:
break;
bonobo_object_release_unref (e->source, ev);
}
+static long
+_get_unique_id ()
+{
+ static long id = 0;
+ return ++id;
+}
+
static void
-registry_notify_listeners ( GList *listeners,
+_registry_notify_listeners ( GList *listeners,
const Accessibility_Event *e,
CORBA_Environment *ev)
{
AccessibleEvent *ev = (AccessibleEvent *) p;
fprintf (stderr, "%s event from %s\n", ev->type,
Accessible_getName (&ev->source));
+ if (Accessible_isComponent (&ev->source))
+ {
+ long x, y, width, height;
+ AccessibleComponent *component = Accessible_getComponent (&ev->source);
+ fprintf (stderr, "Source implements IDL:Accessibility/Component:1.0\n");
+ AccessibleComponent_getExtents (component, &x, &y, &width, &height,
+ COORD_TYPE_SCREEN);
+ fprintf (stderr, "Bounding box: (%ld, %ld) ; (%ld, %ld)\n",
+ x, y, x+width, y+height);
+ }
}
void