Changed at.c to listen to Gtk:GtkWidget:button_press_event
events as well as focus events.
git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@32
e2bd861d-eb25-0410-b326-
f6ed22b6b98c
} EventTypeMajor;
typedef struct {
} EventTypeMajor;
typedef struct {
EventTypeMajor major;
char * minor;
char * detail;
EventTypeMajor major;
char * minor;
char * detail;
#ifdef SPI_DEBUG
fprintf (stderr, "registering app %p\n", application);
#endif
#ifdef SPI_DEBUG
fprintf (stderr, "registering app %p\n", application);
#endif
- ORBit_register_objref (application);
registry->desktop->applications = g_list_append (registry->desktop->applications,
CORBA_Object_duplicate (application, ev));
registry->desktop->applications = g_list_append (registry->desktop->applications,
CORBA_Object_duplicate (application, ev));
-toolkit_listener (GSignalInvocationHint *signal_hint, guint n_param_value,
- const GValue *param_values, gpointer data)
+toolkit_listener (GSignalInvocationHint *signal_hint,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer data)
+ gchar *name =
+ g_signal_name (signal_hint->signal_id);
+ fprintf (stderr, "Received signal %s\n", name);
+
+ /* TODO: notify the actual listeners! */
+
+ return TRUE;
}
static void
register_with_toolkit (EventTypeStruct *etype)
{
}
static void
register_with_toolkit (EventTypeStruct *etype)
{
- guint listener_id =
- atk_add_global_event_listener (toolkit_listener, g_strconcat (etype->minor, etype->detail, NULL));
+ guint listener_id;
+ listener_id =
+ atk_add_global_event_listener (toolkit_listener, etype->event_name);
+#ifdef SPI_DEBUG
+ fprintf (stderr, "registered %d for toolkit events named: %s\n",
+ listener_id,
+ etype->event_name);
+#endif
char * minor_delim_char;
guint nbytes = 0;
char * minor_delim_char;
guint nbytes = 0;
+ etype->event_name = g_strndup(event_name, 255);
+
if (!delimiter)
{
delimiter = g_utf8_get_char (":");
if (!delimiter)
{
delimiter = g_utf8_get_char (":");
etype->major = ETYPE_TOOLKIT;
}
etype->major = ETYPE_TOOLKIT;
}
- if (major_delim_char)
- {
- etype->minor = g_strndup (major_delim_char, nbytes);
- etype->hash = g_str_hash (major_delim_char);
- }
- else
- {
- etype->minor = g_strdup ("");
- etype->hash = g_str_hash ("");
- }
if (major_delim_char != minor_delim_char)
{
if (major_delim_char != minor_delim_char)
{
+ etype->minor = g_strndup (major_delim_char, nbytes);
etype->detail = g_strdup (minor_delim_char);
etype->detail = g_strdup (minor_delim_char);
+ etype->hash = g_str_hash (major_delim_char);
+ if (* (major_delim_char+1))
+ {
+ etype->minor = g_strdup (major_delim_char+1);
+ etype->hash = g_str_hash (major_delim_char+1);
+ }
+ else
+ {
+ etype->minor = g_strdup ("");
+ etype->hash = g_str_hash ("");
+ }
etype->detail = g_strdup ("");
}
etype->detail = g_strdup ("");
}
/* TODO: don't forget to free the strings from caller when done ! */
}
/* TODO: don't forget to free the strings from caller when done ! */
}
} EventTypeMajor;
typedef struct {
} EventTypeMajor;
typedef struct {
EventTypeMajor major;
char * minor;
char * detail;
EventTypeMajor major;
char * minor;
char * detail;
#ifdef SPI_DEBUG
fprintf (stderr, "registering app %p\n", application);
#endif
#ifdef SPI_DEBUG
fprintf (stderr, "registering app %p\n", application);
#endif
- ORBit_register_objref (application);
registry->desktop->applications = g_list_append (registry->desktop->applications,
CORBA_Object_duplicate (application, ev));
registry->desktop->applications = g_list_append (registry->desktop->applications,
CORBA_Object_duplicate (application, ev));
-toolkit_listener (GSignalInvocationHint *signal_hint, guint n_param_value,
- const GValue *param_values, gpointer data)
+toolkit_listener (GSignalInvocationHint *signal_hint,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer data)
+ gchar *name =
+ g_signal_name (signal_hint->signal_id);
+ fprintf (stderr, "Received signal %s\n", name);
+
+ /* TODO: notify the actual listeners! */
+
+ return TRUE;
}
static void
register_with_toolkit (EventTypeStruct *etype)
{
}
static void
register_with_toolkit (EventTypeStruct *etype)
{
- guint listener_id =
- atk_add_global_event_listener (toolkit_listener, g_strconcat (etype->minor, etype->detail, NULL));
+ guint listener_id;
+ listener_id =
+ atk_add_global_event_listener (toolkit_listener, etype->event_name);
+#ifdef SPI_DEBUG
+ fprintf (stderr, "registered %d for toolkit events named: %s\n",
+ listener_id,
+ etype->event_name);
+#endif
char * minor_delim_char;
guint nbytes = 0;
char * minor_delim_char;
guint nbytes = 0;
+ etype->event_name = g_strndup(event_name, 255);
+
if (!delimiter)
{
delimiter = g_utf8_get_char (":");
if (!delimiter)
{
delimiter = g_utf8_get_char (":");
etype->major = ETYPE_TOOLKIT;
}
etype->major = ETYPE_TOOLKIT;
}
- if (major_delim_char)
- {
- etype->minor = g_strndup (major_delim_char, nbytes);
- etype->hash = g_str_hash (major_delim_char);
- }
- else
- {
- etype->minor = g_strdup ("");
- etype->hash = g_str_hash ("");
- }
if (major_delim_char != minor_delim_char)
{
if (major_delim_char != minor_delim_char)
{
+ etype->minor = g_strndup (major_delim_char, nbytes);
etype->detail = g_strdup (minor_delim_char);
etype->detail = g_strdup (minor_delim_char);
+ etype->hash = g_str_hash (major_delim_char);
+ if (* (major_delim_char+1))
+ {
+ etype->minor = g_strdup (major_delim_char+1);
+ etype->hash = g_str_hash (major_delim_char+1);
+ }
+ else
+ {
+ etype->minor = g_strdup ("");
+ etype->hash = g_str_hash ("");
+ }
etype->detail = g_strdup ("");
}
etype->detail = g_strdup ("");
}
/* TODO: don't forget to free the strings from caller when done ! */
}
/* TODO: don't forget to free the strings from caller when done ! */
}
#include "listener.h"
#include "desktop.h"
#include "listener.h"
#include "desktop.h"
+void
+check_ev (CORBA_Environment *ev, char *desc)
+{
+ if (ev->_major != CORBA_NO_EXCEPTION) {
+ fprintf(stderr,
+ ("Accessibility app error: exception during CORBA call %s (%s)\n"),
+ CORBA_exception_id(ev), desc);
+ CORBA_exception_free(ev);
+ exit(-1);
+ }
+}
+
int
main(int argc, char **argv)
{
int
main(int argc, char **argv)
{
bonobo_object_corba_objref (bonobo_object (listener)),
"focus:",
&ev);
bonobo_object_corba_objref (bonobo_object (listener)),
"focus:",
&ev);
+ check_ev (&ev, "register:focus");
+ Accessibility_Registry_registerGlobalEventListener
+ (registry,
+ (Accessibility_EventListener)
+ bonobo_object_corba_objref (bonobo_object (listener)),
+ "Gtk:GtkWidget:button_press_event",
+ &ev);
+ check_ev (&ev, "register:button_press");
fprintf (stderr, "AT callback registered.\n");
fprintf (stderr, "AT callback registered.\n");
desktop = Accessibility_Registry_getDesktop (registry, i, &ev);
fprintf (stderr, "desktop %d name: %s\n", i,
Accessibility_Desktop__get_name (desktop, &ev));
desktop = Accessibility_Registry_getDesktop (registry, i, &ev);
fprintf (stderr, "desktop %d name: %s\n", i,
Accessibility_Desktop__get_name (desktop, &ev));
+ check_ev (&ev, "desktop:name");
n_apps = Accessibility_Desktop__get_childCount (desktop, &ev);
n_apps = Accessibility_Desktop__get_childCount (desktop, &ev);
+ check_ev (&ev, "desktop:childCount");
fprintf (stderr, "desktop has %d apps:\n", n_apps);
for (j=0; j<n_apps; ++j)
{
app = (Accessibility_Application) Accessibility_Desktop_getChildAtIndex (desktop, j, &ev);
fprintf (stderr, "desktop has %d apps:\n", n_apps);
for (j=0; j<n_apps; ++j)
{
app = (Accessibility_Application) Accessibility_Desktop_getChildAtIndex (desktop, j, &ev);
+ check_ev (&ev, "desktop:getChildAtIndex");
fprintf (stderr, "app %d name: %s\n", j,
Accessibility_Application__get_name (app, &ev));
fprintf (stderr, "app %d name: %s\n", j,
Accessibility_Application__get_name (app, &ev));
+ check_ev (&ev, "app:getName");