From 42c740887d5a8a02c6853eaa9d20cb2f3997e335 Mon Sep 17 00:00:00 2001 From: billh Date: Tue, 4 Jun 2002 12:16:45 +0000 Subject: [PATCH] Bugfix for test-simple, reinstated key event listener tests. Updated TODO. git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@312 e2bd861d-eb25-0410-b326-f6ed22b6b98c --- ChangeLog | 19 +++++++++++ TODO | 69 +++++++++++++++++++++++++-------------- cspi/spi_registry.c | 7 ++-- registryd/deviceeventcontroller.c | 14 +++++++- test/test-simple.c | 25 +++++++------- 5 files changed, 92 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index c70fa91..f6fa3c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2002-06-03 Bill Haneman + + * test/test-simple.c: + (key_listener_cb): + Removed #ifdef KEY_IMPL_WORKS guards. + (test_keylisteners): + Removed #ifdef KEY_IMPL_WORKS guards. + Fixed bug which was causing a hang waiting for a + "press" event (which was already overwritten by a "release" + event) from SPI_generateKeyboardEvent with synth-type of SPI_KEY_SYM. + (key_listener_cb): + Added code to set globals 'key_press_received' and + 'key_release_received'. + + * TODO: + Added section "1.1 API Proposed Additions" which + lists API additions desired for at-spi-1.1 (only one so far). + Updated TODO list a little. + 2002-06-02 Bill Haneman AT-SPI 1.0 API FINAL: at-spi 1.0 is now diff --git a/TODO b/TODO index 4ff0ec3..c23f15f 100644 --- a/TODO +++ b/TODO @@ -1,35 +1,24 @@ -TODO: +2.0.0: -idl: - + audit IDL for conformance with bonobo/doc/FAQ's [Java] - naming practice [Michael] + + fix bug #82509 which prevents return of boolean FALSE from + SPI_registerKeystrokeListener for ALL_WINDOWS events + when XGrabKey fails. -cspi: - + ensure spi-listener-impl's list notification methods don't - have a re-enterancy hazard. [Michael] - + Put LGPL headers everywhere. + + fix bug #84100 which means that keygrabs are not released + by the registry when a client dies. Test to make sure + grabs are released when a client requests deregistration + of a key listener. -registry: - + move code into here from libspi [Michael] - + fire an event on dead application & re-factor the listen for - broken code. +2.0.1: + + fix bug affecting multihead at-spi behavior. -bridge: - + move code into here from libspi -libspi: - + remove redundant casts throughout - + determine if there are other headers we don't need to install - + consider moving the non-impl. parts into registryd/ bridge/ etc. - + complete implementation of support for RelationSet and - StateSet, and export to cspi. [Marc] - + complete conversion of static methods to "spi_" namespace. [Bill] +1.1 API Proposed Additions: -test: - + update test-simple to do complete API tests - + Expand tests for AtkTable + + Need API for getting stacking order of toplevel windows. + (bug #84097) -2.2 API Proposed Additions: +1.2 API Proposed Additions: + SPI_dupString () + Additional relation types: FLOWS_TO, FLOWS_FROM @@ -50,4 +39,34 @@ test: long height, SPI_COORD_TYPE type); +/* *********************************************************** */ +TODO: + +idl: + +// + audit IDL for conformance with bonobo/doc/FAQ's [Java] +// naming practice [Michael] + +cspi: + + ensure spi-listener-impl's list notification methods don't + have a re-enterancy hazard. [Michael] + +registry: + + move code into here from libspi [Michael] + + fire an event on dead application & re-factor the listen for + broken code. + +bridge: + + move code into here from libspi + +libspi: + + remove redundant casts throughout + + determine if there are other headers we don't need to install + + consider moving the non-impl. parts into registryd/ bridge/ etc. + + complete conversion of static methods to "spi_" namespace. [Bill] + +test: + + update test-simple to do complete API tests + + Expand tests for AtkTable + diff --git a/cspi/spi_registry.c b/cspi/spi_registry.c index d567d34..7e86360 100644 --- a/cspi/spi_registry.c +++ b/cspi/spi_registry.c @@ -324,10 +324,11 @@ SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener, Accessibility_ControllerEventMask controller_event_mask; Accessibility_DeviceEventController device_event_controller; Accessibility_EventListenerMode listener_mode; + SPIBoolean retval = FALSE; if (!listener) { - return FALSE; + return retval; } device_event_controller = @@ -394,7 +395,7 @@ SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener, listener_mode.global = (CORBA_boolean) ((sync_type & SPI_KEYLISTENER_ALL_WINDOWS)!=0); - Accessibility_DeviceEventController_registerKeystrokeListener ( + retval = Accessibility_DeviceEventController_registerKeystrokeListener ( device_event_controller, cspi_event_listener_get_corba (listener), &key_set, @@ -407,7 +408,7 @@ SPI_registerAccessibleKeystrokeListener (AccessibleKeystrokeListener *listener, cspi_release_unref (device_event_controller); - return TRUE; + return retval; } /** diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c index c0bc354..f023f4e 100644 --- a/registryd/deviceeventcontroller.c +++ b/registryd/deviceeventcontroller.c @@ -49,6 +49,7 @@ /* A pointer to our parent object class */ static GObjectClass *spi_device_event_controller_parent_class; +static int spi_error_code = 0; int (*x_default_error_handler) (Display *display, XErrorEvent *error_event); @@ -89,6 +90,7 @@ static gboolean spi_controller_register_device_listener (SpiDEController CORBA_Environment *ev); static void spi_device_event_controller_forward_key_event (SpiDEController *controller, const XEvent *event); +static gboolean spi_clear_error_state (void); #define spi_get_display() GDK_DISPLAY() @@ -338,6 +340,7 @@ _spi_controller_device_error_handler (Display *display, XErrorEvent *error) if (error->error_code == BadAccess) { g_message ("Could not complete key grab: grab already in use.\n"); + spi_error_code = BadAccess; return 0; } else @@ -529,6 +532,14 @@ spi_notify_keylisteners (GList **key_listeners, return is_consumed; } +static gboolean +spi_clear_error_state () +{ + gboolean retval = spi_error_code != 0; + spi_error_code = 0; + return retval; +} + static Accessibility_DeviceEvent spi_keystroke_from_x_key_event (XKeyEvent *x_key_event) { @@ -732,6 +743,7 @@ spi_controller_update_key_grabs (SpiDEController *controller, True, GrabModeAsync, GrabModeAsync); + /* TODO: set retval to FALSE if an X error occurrs here */ } grab_mask->pending_add = FALSE; @@ -750,7 +762,7 @@ spi_controller_update_key_grabs (SpiDEController *controller, /* TODO: check calls for errors and return FALSE if error occurs */ } - return TRUE; + return ! spi_clear_error_state (); } /* diff --git a/test/test-simple.c b/test/test-simple.c index 814d051..279e53c 100644 --- a/test/test-simple.c +++ b/test/test-simple.c @@ -33,7 +33,6 @@ /* Known bugs */ -#undef KEY_IMPL_WORKS #define WHOLE_STRING -1 static void validate_accessible (Accessible *accessible, @@ -47,6 +46,8 @@ static void validate_accessible (Accessible *accessible, static int print_tree_depth = 0; static gboolean print_tree = FALSE; static gboolean do_poke = FALSE; +static gboolean key_press_received = FALSE; +static gboolean key_release_received = FALSE; typedef struct { gulong magic; @@ -669,32 +670,31 @@ global_listener_cb (const AccessibleEvent *event, validate_accessible (event->source, TRUE, TRUE); } -#ifdef KEY_IMPL_WORKS static SPIBoolean key_listener_cb (const AccessibleKeystroke *stroke, void *user_data) { AccessibleKeystroke *s = user_data; - + *s = *stroke; - + + if (s->type == SPI_KEY_PRESSED) key_press_received = TRUE; + else if (s->type == SPI_KEY_RELEASED) key_release_received = TRUE; + return TRUE; } -#endif + static void test_keylisteners (void) { -#ifdef KEY_IMPL_WORKS int i; AccessibleKeystroke stroke; AccessibleKeystrokeListener *key_listener; AccessibleKeySet *test_keyset; -#endif fprintf (stderr, "Testing keyboard listeners ...\n"); -#ifdef KEY_IMPL_WORKS key_listener = SPI_createAccessibleKeystrokeListener ( key_listener_cb, &stroke); @@ -710,13 +710,15 @@ test_keylisteners (void) for (i = 0; i < 3; i++) { memset (&stroke, 0, sizeof (AccessibleKeystroke)); g_assert (SPI_generateKeyboardEvent ('=', NULL, SPI_KEY_SYM)); - while (!(stroke.type & SPI_KEY_PRESSED)) + while (!(key_press_received)) g_main_context_iteration (NULL, TRUE); fprintf (stderr, "p"); g_assert (!strcmp (stroke.keystring, "=")); - while (!(stroke.type & SPI_KEY_RELEASED)) + while (!(key_release_received)) g_main_context_iteration (NULL, TRUE); fprintf (stderr, "r "); + key_press_received = FALSE; + key_release_received = FALSE; } g_assert (SPI_deregisterAccessibleKeystrokeListener (key_listener, 0)); SPI_freeAccessibleKeySet (test_keyset); @@ -724,9 +726,6 @@ test_keylisteners (void) fprintf (stderr, "\n"); AccessibleKeystrokeListener_unref (key_listener); -#else - fprintf (stderr, " key impl. impossibly broken\n"); -#endif g_assert (SPI_generateMouseEvent (100, 100, "rel")); g_assert (SPI_generateMouseEvent (-50, -50, "rel")); -- 2.7.4