#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <cspi/spi.h>
#include "../util/mag_client.h"
#include "../cspi/spi-private.h" /* A hack for now */
static void report_focus_event (AccessibleEvent *event, void *user_data);
+static void report_generic_event (AccessibleEvent *event, void *user_data);
static void report_button_press (AccessibleEvent *event, void *user_data);
static void check_property_change (AccessibleEvent *event, void *user_data);
static SPIBoolean report_command_key_event (AccessibleKeystroke *stroke, void *user_data);
static AccessibleEventListener *focus_listener;
static AccessibleEventListener *property_listener;
+static AccessibleEventListener *generic_listener;
static AccessibleEventListener *button_listener;
static AccessibleKeystrokeListener *command_key_listener;
static AccessibleKeystrokeListener *ordinary_key_listener;
int i, j;
int n_desktops;
int n_apps;
+ char *s;
Accessible *desktop;
Accessible *application;
- char *s;
+ const char *modules;
- if ((argc > 1) && (!strncmp(argv[1],"-h",2)))
- {
- printf ("Usage: simple-at\n");
- printf ("\tEnvironment variables used:\n\t\tFESTIVAL\n\t\tMAGNIFIER\n\t\tFESTIVAL_CHATTY\n");
- exit(0);
- }
+ if ((argc > 1) && (!strncmp (argv[1], "-h", 2)))
+ {
+ printf ("Usage: simple-at\n");
+ printf ("\tEnvironment variables used:\n\t\tFESTIVAL\n\t\tMAGNIFIER\n\t\tFESTIVAL_CHATTY\n");
+ exit (0);
+ }
+
+ modules = g_getenv ("GTK_MODULES");
+ if (!modules || modules [0] == '\0')
+ {
+ putenv ("GTK_MODULES=gail:at-bridge");
+ }
+ modules = NULL;
- SPI_init(TRUE);
+ SPI_init ();
focus_listener = createAccessibleEventListener (report_focus_event, NULL);
property_listener = createAccessibleEventListener (check_property_change, NULL);
+ generic_listener = createAccessibleEventListener (report_generic_event, NULL);
button_listener = createAccessibleEventListener (report_button_press, NULL);
registerGlobalEventListener (focus_listener, "focus:");
registerGlobalEventListener (property_listener, "object:property-change:accessible-selection");
+ registerGlobalEventListener (generic_listener, "object:selection-changed");
+ registerGlobalEventListener (generic_listener, "object:children-changed");
+ registerGlobalEventListener (generic_listener, "object:visible-data-changed");
+ registerGlobalEventListener (generic_listener, "object:text-selection-changed");
+ registerGlobalEventListener (generic_listener, "object:text-caret-moved");
+ registerGlobalEventListener (generic_listener, "object:text-changed");
registerGlobalEventListener (button_listener, "Gtk:GtkWidget:button-press-event");
n_desktops = getDesktopCount ();
(unsigned long) ( KeyPress | KeyRelease),
SPI_KEYLISTENER_NOSYNC);
- get_environment_vars();
+ get_environment_vars ();
- SPI_event_main();
+ SPI_event_main ();
+
+ setenv ("AT_BRIDGE_SHUTDOWN", "1", TRUE);
+
+ return SPI_exit ();
}
static void
fprintf (stderr, "Using magnifier\n");
use_magnifier = TRUE;
}
+ else
+ {
+ fprintf (stderr, "Not using magnifier\n");
+ }
+
+ if (!use_festival)
+ {
+ fprintf (stderr, "No speech output\n");
+ }
}
void
char *s;
int len;
- g_warning ("Report focused !");
-
if (use_festival)
{
- if (festival_chatty)
- {
- _festival_say (Accessible_getRole (obj), "voice_don_diphone", shutup_previous_speech);
- }
+ if (festival_chatty)
+ {
+ _festival_say (Accessible_getRole (obj), "voice_don_diphone", shutup_previous_speech);
+ }
fprintf (stderr, "getting Name\n");
s = Accessible_getName (obj);
_festival_say (s, "voice_kal_diphone",
magnifier_set_roi ((short) 0, x, y, width, height);
}
}
+
+ if (Accessible_isValue (obj))
+ {
+ AccessibleValue *value = Accessible_getValue (obj);
+ fprintf (stderr, "Current value = %f, min = %f; max = %f\n",
+ AccessibleValue_getCurrentValue (value),
+ AccessibleValue_getMinimumValue (value),
+ AccessibleValue_getMaximumValue (value));
+ }
/* if this is a text object, speak the first sentence. */
if (Accessible_isText(obj))
{
char *s;
- g_warning ("report focus event");
-
g_return_if_fail (event->source != NULL);
s = Accessible_getName (event->source);
- if (cspi_warn_ev (cspi_ev (), "Foobar"))
+ if (s)
{
fprintf (stderr, "%s event from %s\n", event->type, s);
SPI_freeString (s);
}
void
+report_generic_event (AccessibleEvent *event, void *user_data)
+{
+ fprintf (stderr, "%s event received\n", event->type);
+}
+
+void
report_button_press (AccessibleEvent *event, void *user_data)
{
char *s;
simple_at_exit ()
{
deregisterGlobalEventListenerAll (focus_listener);
+ AccessibleEventListener_unref (focus_listener);
+
deregisterGlobalEventListenerAll (property_listener);
+ AccessibleEventListener_unref (property_listener);
+
+ deregisterGlobalEventListenerAll (generic_listener);
+ AccessibleEventListener_unref (generic_listener);
+
deregisterGlobalEventListenerAll (button_listener);
+ AccessibleEventListener_unref (button_listener);
- deregisterAccessibleKeystrokeListener (command_key_listener, SPI_KEYMASK_ALT );
- deregisterAccessibleKeystrokeListener (ordinary_key_listener, SPI_KEYMASK_UNMODIFIED );
- deregisterAccessibleKeystrokeListener (ordinary_key_listener, SPI_KEYMASK_SHIFT );
+ deregisterAccessibleKeystrokeListener (command_key_listener, SPI_KEYMASK_ALT);
AccessibleKeystrokeListener_unref (command_key_listener);
+
+ deregisterAccessibleKeystrokeListener (ordinary_key_listener, SPI_KEYMASK_UNMODIFIED);
+ deregisterAccessibleKeystrokeListener (ordinary_key_listener, SPI_KEYMASK_SHIFT);
AccessibleKeystrokeListener_unref (ordinary_key_listener);
- SPI_exit ();
+ SPI_event_quit ();
}
static SPIBoolean