* cspi/spi_accessible.c (role_names): add a role name
to sync this array with the enum; and make the regression
tests pass, sigh.
2002-01-10 Michael Meeks <michael@ximian.com>
* cspi/spi_registry.c (SPI_generateKeyboardEvent):
allow expansion of enumeration & kill warning.
* test/test-simple.c (key_listener_cb): impl.
(test_keylisteners): impl.
* cspi/spi-listener.h: make listener signatures const
on the provided (const) events.
* test/keysynth-demo.c: upd. to const events.
* test/simple-at.c: ditto.
git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@216
e2bd861d-eb25-0410-b326-
f6ed22b6b98c
-2002-01-11 Bill Haneman <bill.haneman@sun.com>
+2002-01-11 Michael Meeks <michael@ximian.com>
+
+ * cspi/spi_accessible.c (role_names): add a role name
+ to sync this array with the enum; and make the regression
+ tests pass, sigh.
+
+2002-01-10 Michael Meeks <michael@ximian.com>
+
+ * cspi/spi_registry.c (SPI_generateKeyboardEvent):
+ allow expansion of enumeration & kill warning.
+
+ * test/test-simple.c (key_listener_cb): impl.
+ (test_keylisteners): impl.
+
+ * cspi/spi-listener.h: make listener signatures const
+ on the provided (const) events.
+
+ * test/keysynth-demo.c: upd. to const events.
+
+ * test/simple-at.c: ditto.
+
+2002-10-01 Bill Haneman <bill.haneman@sun.com>
* test/demo.csh:
Checked in a demo script, which requires editing before use!
*
* SPIBoolean (*AccessibleKeystrokeListenerCB) (AccessibleKeystrokeEvent *Event);
*/
-typedef void (*AccessibleEventListenerCB) (AccessibleEvent *event,
- void *user_data);
-typedef SPIBoolean (*AccessibleKeystrokeListenerCB) (AccessibleKeystroke *stroke,
- void *user_data);
+typedef void (*AccessibleEventListenerCB) (const AccessibleEvent *event,
+ void *user_data);
+typedef SPIBoolean (*AccessibleKeystrokeListenerCB) (const AccessibleKeystroke *stroke,
+ void *user_data);
#ifdef __cplusplus
}
"calendar",
"canvas",
"check box",
+ "check menu item",
"color chooser",
"column header",
"combo box",
case SPI_KEY_STRING:
keysynth_type = Accessibility_KEY_STRING;
break;
+ default:
+ return FALSE;
}
Accessibility_DeviceEventController_generateKeyboardEvent (device_event_controller,
}
static SPIBoolean
-is_command_key (AccessibleKeystroke *key, void *user_data)
+is_command_key (const AccessibleKeystroke *key, void *user_data)
{
switch (key->keyID)
{
}
static SPIBoolean
-switch_callback (AccessibleKeystroke *key, void *user_data)
+switch_callback (const AccessibleKeystroke *key, void *user_data)
{
static SPIBoolean is_down = FALSE;
#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 SPIBoolean report_ordinary_key_event (AccessibleKeystroke *stroke, void *user_data);
+static void report_focus_event (const AccessibleEvent *event, void *user_data);
+static void report_generic_event (const AccessibleEvent *event, void *user_data);
+static void report_button_press (const AccessibleEvent *event, void *user_data);
+static void check_property_change (const AccessibleEvent *event, void *user_data);
+static SPIBoolean report_command_key_event (const AccessibleKeystroke *stroke, void *user_data);
+static SPIBoolean report_ordinary_key_event (const AccessibleKeystroke *stroke, void *user_data);
static void get_environment_vars (void);
static int _festival_init ();
}
void
-report_focus_event (AccessibleEvent *event, void *user_data)
+report_focus_event (const AccessibleEvent *event, void *user_data)
{
char *s;
}
void
-report_generic_event (AccessibleEvent *event, void *user_data)
+report_generic_event (const AccessibleEvent *event, void *user_data)
{
fprintf (stderr, "%s event received\n", event->type);
}
void
-report_button_press (AccessibleEvent *event, void *user_data)
+report_button_press (const AccessibleEvent *event, void *user_data)
{
char *s;
}
void
-check_property_change (AccessibleEvent *event, void *user_data)
+check_property_change (const AccessibleEvent *event, void *user_data)
{
AccessibleSelection *selection = Accessible_getSelection (event->source);
int n_selections;
}
static SPIBoolean
-is_command_key (AccessibleKeystroke *key)
+is_command_key (const AccessibleKeystroke *key)
{
switch (key->keyID)
{
}
static SPIBoolean
-report_command_key_event (AccessibleKeystroke *key, void *user_data)
+report_command_key_event (const AccessibleKeystroke *key, void *user_data)
{
fprintf (stderr, "Command KeyEvent %s%c (keycode %d); string=%s; time=%lx\n",
(key->modifiers & SPI_KEYMASK_ALT)?"Alt-":"",
static SPIBoolean
-report_ordinary_key_event (AccessibleKeystroke *key, void *user_data)
+report_ordinary_key_event (const AccessibleKeystroke *key, void *user_data)
{
fprintf (stderr, "Received key event:\tsym %ld\n\tmods %x\n\tcode %d\n\tstring=\'%s\'\n\ttime %lx\n",
(long) key->keyID,
}
static void
-global_listener_cb (AccessibleEvent *event,
- void *user_data)
+global_listener_cb (const AccessibleEvent *event,
+ void *user_data)
{
TestWindow *win = user_data;
Accessible *desktop;
validate_accessible (event->source, TRUE, TRUE);
}
+static SPIBoolean
+key_listener_cb (const AccessibleKeystroke *stroke,
+ void *user_data)
+{
+ AccessibleKeystroke *s = user_data;
+
+ *s = *stroke;
+
+ g_warning ("Key listener callback");
+
+ return FALSE;
+}
+
+static void
+test_keylisteners (void)
+{
+ AccessibleKeystroke stroke;
+ AccessibleKeystrokeListener *key_listener;
+
+ key_listener = SPI_createAccessibleKeystrokeListener (
+ key_listener_cb, &stroke);
+
+ g_assert (SPI_registerAccessibleKeystrokeListener (
+ key_listener, SPI_KEYSET_ALL_KEYS, 0,
+ SPI_KEY_PRESSED | SPI_KEY_RELEASED,
+ SPI_KEYLISTENER_CANCONSUME));
+
+#if FIXME_HOW_SHOULD_THIS_WORK
+ memset (&stroke, 0, sizeof (AccessibleKeystroke));
+
+ g_assert (SPI_generateKeyboardEvent (33, "!", SPI_KEY_PRESSRELEASE));
+
+ while (stroke.type == 0)
+ g_main_iteration (TRUE);
+
+ g_assert (!strcmp (stroke.keystring, "!"));
+ g_assert (stroke.type == SPI_KEY_PRESSRELEASE);
+#endif
+
+ g_assert (SPI_deregisterAccessibleKeystrokeListener (key_listener, 0));
+
+ AccessibleKeystrokeListener_unref (key_listener);
+}
+
int
main (int argc, char **argv)
{
test_roles ();
test_misc ();
test_desktop ();
+ test_keylisteners ();
win = create_test_window ();