Re: [g-a-devel]proto at-spi patch ... split - 1
- From: Michael Meeks <michael ximian com>
- To: Michael Meeks <michael ximian com>
- Cc: Bill Haneman <bill haneman sun com>, accessibility mailing list <gnome-accessibility-devel gnome org>
- Subject: Re: [g-a-devel]proto at-spi patch ... split - 1
- Date: 10 Jan 2002 10:57:21 +0000
Hi Bill,
This patch splits out the most critical bit - the const on the event;
which is really rather important ( but will only give warnings for
people who havn't used const ).
The re-enterancy fixes on the keybindings I am very happy to implement
- but I'd rather have a regression tests that actually works. This patch
also adds that - but it fails to recieve a synthesised key event. Why is
that ?
What mask do I have to pass to get a keygrab on normal keys, or what
test can I use here ? I see tests in simple-at, but these only grab keys
in combination with Shift / Control AFAICS.
Anyway - once we have a working test, I'll re-merge the
deviceeventcontroller fixage - the reenterency bugs in there are really
quite severe, so it'd be good to get a test working soon.
Regards,
Michael.
? docs/reference/cspi/tmpl/at-spi-cspi-unused.sgml
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/at-spi/ChangeLog,v
retrieving revision 1.134
diff -u -p -u -r1.134 ChangeLog
--- ChangeLog 2002/01/08 09:11:43 1.134
+++ ChangeLog 2002/01/10 10:50:13
@@ -1,3 +1,18 @@
+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-01-08 Michael Meeks <michael ximian com>
* registryd/registry.c (parse_event_type): remove strndup.
Index: cspi/spi-listener.h
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi-listener.h,v
retrieving revision 1.15
diff -u -p -u -r1.15 spi-listener.h
--- cspi/spi-listener.h 2001/12/18 11:24:56 1.15
+++ cspi/spi-listener.h 2002/01/10 10:50:13
@@ -42,10 +42,10 @@ typedef struct {
*
* 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
}
Index: cspi/spi_registry.c
===================================================================
RCS file: /cvs/gnome/at-spi/cspi/spi_registry.c,v
retrieving revision 1.28
diff -u -p -u -r1.28 spi_registry.c
--- cspi/spi_registry.c 2002/01/08 09:11:44 1.28
+++ cspi/spi_registry.c 2002/01/10 10:50:13
@@ -501,6 +501,8 @@ SPI_generateKeyboardEvent (long int keyv
case SPI_KEY_STRING:
keysynth_type = Accessibility_KEY_STRING;
break;
+ default:
+ return FALSE;
}
Accessibility_DeviceEventController_generateKeyboardEvent (device_event_controller,
Index: test/keysynth-demo.c
===================================================================
RCS file: /cvs/gnome/at-spi/test/keysynth-demo.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 keysynth-demo.c
--- test/keysynth-demo.c 2002/01/01 22:35:33 1.14
+++ test/keysynth-demo.c 2002/01/10 10:50:13
@@ -319,7 +319,7 @@ button_exit (GtkButton *notused, void *a
}
static SPIBoolean
-is_command_key (AccessibleKeystroke *key, void *user_data)
+is_command_key (const AccessibleKeystroke *key, void *user_data)
{
switch (key->keyID)
{
@@ -332,7 +332,7 @@ is_command_key (AccessibleKeystroke *key
}
static SPIBoolean
-switch_callback (AccessibleKeystroke *key, void *user_data)
+switch_callback (const AccessibleKeystroke *key, void *user_data)
{
static SPIBoolean is_down = FALSE;
Index: test/simple-at.c
===================================================================
RCS file: /cvs/gnome/at-spi/test/simple-at.c,v
retrieving revision 1.31
diff -u -p -u -r1.31 simple-at.c
--- test/simple-at.c 2002/01/08 09:11:47 1.31
+++ test/simple-at.c 2002/01/10 10:50:14
@@ -28,12 +28,12 @@
#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 ();
@@ -242,7 +242,7 @@ report_focussed_accessible (Accessible *
}
void
-report_focus_event (AccessibleEvent *event, void *user_data)
+report_focus_event (const AccessibleEvent *event, void *user_data)
{
char *s;
@@ -259,13 +259,13 @@ report_focus_event (AccessibleEvent *eve
}
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;
@@ -281,7 +281,7 @@ report_button_press (AccessibleEvent *ev
}
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;
@@ -335,7 +335,7 @@ simple_at_exit ()
}
static SPIBoolean
-is_command_key (AccessibleKeystroke *key)
+is_command_key (const AccessibleKeystroke *key)
{
switch (key->keyID)
{
@@ -359,7 +359,7 @@ is_command_key (AccessibleKeystroke *key
}
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-":"",
@@ -373,7 +373,7 @@ report_command_key_event (AccessibleKeys
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,
Index: test/test-simple.c
===================================================================
RCS file: /cvs/gnome/at-spi/test/test-simple.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 test-simple.c
--- test/test-simple.c 2002/01/08 09:11:47 1.16
+++ test/test-simple.c 2002/01/10 10:50:14
@@ -611,8 +611,8 @@ test_misc (void)
}
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;
@@ -643,6 +643,50 @@ global_listener_cb (AccessibleEvent
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)
{
@@ -670,6 +714,7 @@ main (int argc, char **argv)
test_roles ();
test_misc ();
test_desktop ();
+ test_keylisteners ();
win = create_test_window ();
--
mmeeks gnu org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]