+2003-06-25 Padraig O'Briain <padraig.obriain@sun.com>
+
+ * atk-bridge/bridge.c:
+ (atk_bridge_init): Add signal handler for children-changed:remove on
+ root when in a BonoboComponent.
+ (spi_atk_bridge_toplevel_added): Call spi_atk_bridge_do_registration
+ for first toplevel only other incrememt variable toplevels.
+ (spi_atk_bridge_toplevel_removed): For last toplevel deregister
+ application and remove listeners.
+ (spi_atk_bridge_get-registry): Change NULL to CORBA_OBJECT_NIL for
+ consistency.
+ (spi_atk_deregister_event_listeners): New function which removes
+ listeners.
+ (reinit_register_vars): New fuction which reinitializes variables.
+
+ This fixes bug #111578.
+
2003-06-13 Bill Haneman <bill.haneman@sun.com>
* configure.in: version 1.3.4.
static SpiApplication *this_app = NULL;
static gboolean registry_died = FALSE;
static gboolean atk_listeners_registered = FALSE;
-static guint toplevel_handler;
+static gint toplevels = 0;
static guint atk_signal_text_changed;
static guint atk_signal_children_changed;
static void spi_atk_bridge_toplevel_added (AtkObject *object,
guint index,
AtkObject *child);
+static void spi_atk_bridge_toplevel_removed (AtkObject *object,
+ guint index,
+ AtkObject *child);
static void spi_atk_bridge_exit_func (void);
static void spi_atk_register_event_listeners (void);
+static void spi_atk_deregister_event_listeners (void);
static void spi_atk_bridge_focus_tracker (AtkObject *object);
static void spi_atk_bridge_register_application (Accessibility_Registry registry);
static gboolean spi_atk_bridge_property_event_listener (GSignalInvocationHint *signal_hint,
static gint spi_atk_bridge_key_listener (AtkKeyEventStruct *event,
gpointer data);
static void spi_atk_tidy_windows (void);
+static void deregister_application (BonoboObject *app);
+static void reinit_register_vars (void);
/* For automatic libgnome init */
extern void gnome_accessibility_module_init (void);
if (bonobo_activation_iid_get ())
{
DBG (1, g_message ("Found Bonobo component\n"));
- toplevel_handler = g_signal_connect (atk_get_root (),
- "children-changed::add",
- (GCallback) spi_atk_bridge_toplevel_added,
- NULL);
+ g_signal_connect (atk_get_root (),
+ "children-changed::add",
+ (GCallback) spi_atk_bridge_toplevel_added,
+ NULL);
+ g_signal_connect (atk_get_root (),
+ "children-changed::remove",
+ (GCallback) spi_atk_bridge_toplevel_removed,
+ NULL);
}
else
{
guint index,
AtkObject *child)
{
- g_signal_handler_disconnect (object, toplevel_handler);
- spi_atk_bridge_do_registration ();
+ if (toplevels == 0)
+ spi_atk_bridge_do_registration ();
+ toplevels++;
+}
+
+static void
+spi_atk_bridge_toplevel_removed (AtkObject *object,
+ guint index,
+ AtkObject *child)
+{
+ BonoboObject *app = (BonoboObject *) this_app;
+
+ toplevels--;
+ if (toplevels == 0)
+ {
+ deregister_application (app);
+ spi_atk_deregister_event_listeners ();
+ reinit_register_vars ();
+ }
+ if (toplevels < 0)
+ {
+ g_warning ("More toplevels removed than added\n");
+ toplevels = 0;
+ }
}
static void
{
CORBA_Environment ev;
- if (registry_died || (registry == NULL)) {
+ if (registry_died || (registry == CORBA_OBJECT_NIL)) {
CORBA_exception_init (&ev);
if (registry_died)
DBG (1, g_warning ("registry died! restarting..."));
}
static void
+spi_atk_deregister_event_listeners (void)
+{
+ gint i;
+ guint id;
+
+ if (!atk_listeners_registered)
+ return;
+
+ atk_listeners_registered = FALSE;
+
+ for (i = 0; i < listener_ids->len; i++)
+ {
+ id = g_array_index (listener_ids, guint, i);
+ atk_remove_global_event_listener (id);
+ }
+ g_array_free (listener_ids, TRUE);
+ listener_ids = NULL;
+
+ atk_remove_focus_tracker (atk_bridge_focus_tracker_id);
+ atk_bridge_focus_tracker_id = 0;
+
+ atk_remove_key_event_listener (atk_bridge_key_event_listener_id);
+ atk_bridge_key_event_listener_id = 0;
+}
+
+static void
deregister_application (BonoboObject *app)
{
Accessibility_Registry registry = spi_atk_bridge_get_registry ();
g_object_unref (child);
}
}
+
+static void
+reinit_register_vars (void)
+{
+ registry = CORBA_OBJECT_NIL;
+ device_event_controller = CORBA_OBJECT_NIL;
+ this_app = NULL;
+}
+