Added ROLE_APPLICATION; fix for 99090. Depend on atk 1.1.3.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Wed, 20 Nov 2002 17:14:30 +0000 (17:14 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Wed, 20 Nov 2002 17:14:30 +0000 (17:14 +0000)
Revved to 1.1.5.

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@365 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
atk-bridge/bridge.c
cspi/spi-roletypes.h
cspi/spi_accessible.c
docs/reference/cspi/tmpl/spi_accessible.sgml
idl/Accessibility_Role.idl

index 5114954..860fcbc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2002-11-20  Bill Haneman  <bill.haneman@sun.com>
+
+       * cspi/spi_accessible.c:
+       (AccessibleRole_getName):
+       Added necessary strings for making this (deprecated) 
+       method work with the new role types. 
+       (init_role_table, role_table):
+       Added definition of SPI_ROLE_APPLICATION.
+
+       * libspi/spi-roletypes.h:
+       Added SPI_ROLE_APPLICATION.
+
+       * idl/Accessibility_Role.idl:
+       Added ROLE_APPLICATION. 
+
+       * docs/reference/cspi/at-spi-cspi-decl.txt:
+       Added SPI_ROLE_APPLICATION to docs.
+
 2002-11-20  Padraig O'Briain  <padraig.obriain@sun.com>
 
        * cspi/spi_accessible.c
index dfb8d4f..cabf009 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdarg.h>
 #include <libbonobo.h>
 #include <orbit/orbit.h>
+#include <glib-object.h>
 #include <atk/atk.h>
 #include <atk/atkobject.h>
 #include <atk/atknoopobject.h>
@@ -139,7 +140,7 @@ extern void gnome_accessibility_module_init     (void);
 extern void gnome_accessibility_module_shutdown (void);
 
 static void
-atk_bridge_init_event_type_consts ()
+spi_atk_bridge_init_event_type_consts ()
 {
   atk_signal_child_changed = g_signal_lookup ("child_changed", 
                                              ATK_TYPE_OBJECT);
@@ -156,7 +157,7 @@ atk_bridge_init (gint *argc, gchar **argv[])
     }
   atk_bridge_initialized = TRUE;
 
-  _dbg = g_ascii_digit_value (g_getenv ("AT_SPI_DEBUG"));
+  _dbg = (int) g_ascii_strtod (g_getenv ("AT_SPI_DEBUG"), NULL);
 
   if (!bonobo_init (argc, argv ? *argv : NULL))
     {
@@ -268,7 +269,7 @@ gtk_module_init (gint *argc, gchar **argv[])
 }
 
 static void
-add_signal_listener (const char *signal_name)
+spi_atk_bridge_add_signal_listener (const char *signal_name)
 {
   guint id;
 
@@ -323,19 +324,19 @@ spi_atk_register_event_listeners (void)
                                      "Gtk:AtkObject:state-change");
   g_array_append_val (listener_ids, id);
 
-  add_signal_listener ("Gtk:AtkObject:children-changed");
-  add_signal_listener ("Gtk:AtkObject:visible-data-changed");
-  add_signal_listener ("Gtk:AtkSelection:selection-changed");
-  add_signal_listener ("Gtk:AtkText:text-selection-changed");
-  add_signal_listener ("Gtk:AtkText:text-changed");
-  add_signal_listener ("Gtk:AtkText:text-caret-moved");
-  add_signal_listener ("Gtk:AtkTable:row-inserted");
-  add_signal_listener ("Gtk:AtkTable:row-reordered");
-  add_signal_listener ("Gtk:AtkTable:row-deleted");
-  add_signal_listener ("Gtk:AtkTable:column-inserted");
-  add_signal_listener ("Gtk:AtkTable:column-reordered");
-  add_signal_listener ("Gtk:AtkTable:column-deleted");
-  add_signal_listener ("Gtk:AtkTable:model-changed");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkObject:children-changed");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkObject:visible-data-changed");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkSelection:selection-changed");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkText:text-selection-changed");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkText:text-changed");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkText:text-caret-moved");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkTable:row-inserted");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkTable:row-reordered");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkTable:row-deleted");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkTable:column-inserted");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkTable:column-reordered");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkTable:column-deleted");
+  spi_atk_bridge_add_signal_listener ("Gtk:AtkTable:model-changed");
 /*
  * May add the following listeners to implement preemptive key listening for GTK+
  *
@@ -350,7 +351,7 @@ spi_atk_register_event_listeners (void)
 }
 
 static void
-deregister_application (BonoboObject *app)
+spi_atk_bridge_deregister_application (BonoboObject *app)
 {
   Accessibility_Registry registry = spi_atk_bridge_get_registry ();    
   Accessibility_Registry_deregisterApplication (registry, BONOBO_OBJREF (app), &ev);
@@ -385,7 +386,7 @@ spi_atk_bridge_exit_func (void)
       g_assert (bonobo_activate ());
     }
   
-  deregister_application (app);
+  spi_atk_bridge_deregister_application (app);
 
   DBG (1, g_message ("bridge exit func complete.\n"));
 
@@ -433,8 +434,8 @@ gnome_accessibility_module_shutdown (void)
 }
 
 static void
-atk_bridge_event_context_init (CORBA_any *any, 
-                              AtkBridgeEventContext *ctx)
+spi_atk_bridge_event_context_init (CORBA_any *any, 
+                                  AtkBridgeEventContext *ctx)
 {
   SpiAccessible *accessible;
   if (ctx) 
@@ -486,10 +487,13 @@ AtkBridgeEventContext *
 spi_atk_bridge_event_context_create (GObject *gobject, 
                                     long detail1, 
                                     long detail2, 
-                                    GSignalQuery *signal_query, 
-                                    const gchar *detail)
+                                    GSignalQuery *signal_query)
 {
   AtkBridgeEventContext *ctx = g_new0 (AtkBridgeEventContext, 1);
+  /* don't free the context, it's on the stack */
+
+  /* if it's a window event, then marshal the window name */
+
   /*
   if (signal_query->signal_id == atk_signal_child_changed) 
     {  
@@ -497,7 +501,7 @@ spi_atk_bridge_event_context_create (GObject *gobject,
       ctx->_data.object = atk_object_ref_accessible_child (ATK_OBJECT (gobject),
                                                           (gint) detail1);
     }
-  else */ if (signal_query->signal_id == atk_signal_text_changed)
+  else */ if (signal_query && (signal_query->signal_id == atk_signal_text_changed))
     {
       ctx->_type = ATK_BRIDGE_CONTEXT_TYPE_STRING;
       ctx->_data.string = atk_text_get_text (ATK_TEXT (gobject),
@@ -519,17 +523,31 @@ spi_atk_bridge_event_context_free (AtkBridgeEventContext *ctx)
   g_free (ctx);
 }
 
+
+static void
+spi_atk_bridge_any_init ()
+{
+  AtkBridgeEventContext *ctx;
+  /* build some event context data, depending on the type */
+  ctx = spi_atk_bridge_event_context_create (gobject, 
+                                            detail1, detail2, 
+                                            signal_query);
+  spi_atk_bridge_event_context_init (&e.any_data, ctx); 
+  spi_atk_bridge_event_context_free (ctx);
+}
+
 static void
 spi_atk_emit_eventv (GObject               *gobject,
                     unsigned long          detail1,
                     unsigned long          detail2,
-                    AtkBridgeEventContext *context,
+                    GSignalQuery          *signal_query,
                     const char   *format, ...)
 {
   va_list             args;
   Accessibility_Event e;
   SpiAccessible      *source;
   AtkObject          *aobject;
+  AtkBridgeEventContext *ctx;
 #ifdef SPI_BRIDGE_DEBUG
   CORBA_string s;
 #endif
@@ -567,8 +585,10 @@ spi_atk_emit_eventv (GObject               *gobject,
       CORBA_free (s);
 #endif
       CORBA_exception_init (&ev);
-      atk_bridge_event_context_init (&e.any_data, context); 
-      Accessibility_Registry_notifyEvent (spi_atk_bridge_get_registry (), &e, &ev);
+      spi_atk_bridge_event_any_init (&e.any_data, gobject, 
+                                    detail1, detail2, signal_query);
+      Accessibility_Registry_notifyEvent (spi_atk_bridge_get_registry (), 
+                                         &e, &ev);
       /* I haven't freed any_data._value when it's a char*, does it leak ? */
 #ifdef SPI_BRIDGE_DEBUG
       if (ev._major != CORBA_NO_EXCEPTION)
@@ -784,22 +804,13 @@ spi_atk_bridge_signal_listener (GSignalInvocationHint *signal_hint,
   if (G_VALUE_TYPE (param_values + 2) == G_TYPE_INT)
     detail2 = g_value_get_int (param_values + 2);
 
-  /* build some event context data, depending on the type */
-  ctx = spi_atk_bridge_event_context_create (gobject, 
-                                            detail1, detail2, 
-                                            &signal_query, 
-                                            detail);
-
   if (detail)
-    spi_atk_emit_eventv (gobject, detail1, detail2, ctx,
+    spi_atk_emit_eventv (gobject, detail1, detail2, &signal_query,
                         "object:%s:%s", name, detail);
   else
-    spi_atk_emit_eventv (gobject, detail1, detail2, ctx,
+    spi_atk_emit_eventv (gobject, detail1, detail2, &signal_query,
                         "object:%s", name);
 
-  if (ctx) 
-    spi_atk_bridge_event_context_free (ctx);
-
   return TRUE;
 }
 
@@ -830,11 +841,7 @@ spi_atk_bridge_window_event_listener (GSignalInvocationHint *signal_hint,
 #endif
   
   gobject = g_value_get_object (param_values + 0);
-  ctx._type = ATK_BRIDGE_CONTEXT_TYPE_STRING;
-  s = atk_object_get_name (ATK_OBJECT (gobject));
-  ctx._data.string = (gchar *) s;
-  /* cast from const silences compiler */
-  spi_atk_emit_eventv (gobject, 0, 0, &ctx, "window:%s", name);
-  /* don't free the context, it's on the stack */
+  spi_atk_emit_eventv (gobject, 0, 0, &signal_query, "window:%s", name);
+
   return TRUE;
 }
index 039b368..3e9582d 100644 (file)
@@ -136,6 +136,8 @@ extern "C" {
  * @SPI_ROLE_PARAGRAPH: An object which is contains a paragraph of text content.
  * @SPI_ROLE_RULER: An object which describes margins and tab stops, etc.  for text objects 
  *                  which it controls (should have CONTROLLER_FOR relation to such). 
+ * @SPI_ROLE_APPLICATION: An object which corresponds to a desktop application,
+ *                  which may have children of @SPI_ROLE_FRAME or other type.
  * @SPI_ROLE_LAST_DEFINED: Used to determine the end of the role enumeration.
  **/
 typedef enum
@@ -214,6 +216,7 @@ typedef enum
   SPI_ROLE_FOOTER,
   SPI_ROLE_PARAGRAPH,
   SPI_ROLE_RULER,
+  SPI_ROLE_APPLICATION,
   SPI_ROLE_LAST_DEFINED
 } AccessibleRole;
 
index d927aca..f517693 100644 (file)
@@ -95,7 +95,12 @@ static const char *role_names [] =
   "unknown",
   "viewport",
   "window",
-
+  NULL,
+  "header",
+  "fooler",
+  "paragraph",
+  "ruler",
+  "application"
 };
 
 #define MAX_ROLES (sizeof (role_names) / sizeof (char *))
@@ -181,6 +186,7 @@ cspi_init_role_table (AccessibleRole *role_table)
   role_table [Accessibility_ROLE_FOOTER] = SPI_ROLE_FOOTER;
   role_table [Accessibility_ROLE_PARAGRAPH] = SPI_ROLE_PARAGRAPH;
   role_table [Accessibility_ROLE_RULER] = SPI_ROLE_RULER;
+  role_table [Accessibility_ROLE_APPLICATION] = SPI_ROLE_APPLICATION;
 
   return TRUE;
 }
@@ -281,7 +287,7 @@ spi_state_type_from_accessible_state (AccessibleState type)
 char *
 AccessibleRole_getName (AccessibleRole role)
 {
-  if (role < MAX_ROLES)
+  if (role < MAX_ROLES && role_names [(int) role])
     {
       return CORBA_string_dup (role_names [(int) role]);
     }
index e7ffb5d..a4dd96c 100644 (file)
@@ -421,6 +421,7 @@ Accessible Objects
 @SPI_ROLE_FOOTER: 
 @SPI_ROLE_PARAGRAPH: 
 @SPI_ROLE_RULER: 
+@SPI_ROLE_APPLICATION: 
 @SPI_ROLE_LAST_DEFINED: 
 
 <!-- ##### FUNCTION AccessibleRole_getName ##### -->
index 460ddcd..bf74a79 100644 (file)
@@ -257,6 +257,13 @@ module Accessibility {
    * (should have CONTROLLER_FOR relation to such). 
    */
   ROLE_RULER,
+  /*
+   * An object corresponding to the toplevel accessible of an 
+   * application, which may contain ROLE_FRAME objects or other
+   * accessible objects.  Children of AccessibleDesktop objects 
+   * are generally ROLE_APPLICATION objects.
+   */
+  ROLE_APPLICATION,
   /* not a valid role, used for finding end of enumeration. */
   ROLE_LAST_DEFINED
   };