Renamed "target" member of Event to "source".
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Sat, 18 Aug 2001 22:20:42 +0000 (22:20 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Sat, 18 Aug 2001 22:20:42 +0000 (22:20 +0000)
Improved simple-at test and accessibleeventlistener.c to
send actual event structs.

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

14 files changed:
ChangeLog
at-bridge/bridge.c
atk-bridge/bridge.c
cspi/spi-listener.h
idl/Accessibility_Event.idl
idl/Event.idl
libspi/accessibleeventlistener.c
libspi/application.c
libspi/eventlistener.c
libspi/listener.c
libspi/registry.c
registryd/registry.c
test/app.c
test/simple-at.c

index f0d5258..92c73fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,14 @@
        * test/Makefile.am :
        * test/simple-at.c :
        Added new test that uses the C bindings API.
+       * idl/Event.idl :
+       * libspi/listener.c :
+       * libspi/registry.c :
+       * libspi/accessibleeventlistener.c :
+       * at-bridge/bridge.c :
+       Renamed member "target" of Accessibility_Event to "source",
+       which is more descriptive.
+       
 
 2001-08-18  Bill Haneman <bill.haneman@sun.com>
 
index 9da60d4..7b3c876 100644 (file)
@@ -107,7 +107,7 @@ static void bridge_focus_tracker (AtkObject *object)
 {
   Accessibility_Event *e = g_new0(Accessibility_Event, 1);
   e->type = CORBA_string_dup ("focus:");
-  e->target = bonobo_object_corba_objref (bonobo_object (accessible_new (object)));
+  e->source = bonobo_object_corba_objref (bonobo_object (accessible_new (object)));
   e->detail1 = 0;
   e->detail2 = 0;
   Accessibility_Registry_notifyEvent (registry, e, &ev);
index 9da60d4..7b3c876 100644 (file)
@@ -107,7 +107,7 @@ static void bridge_focus_tracker (AtkObject *object)
 {
   Accessibility_Event *e = g_new0(Accessibility_Event, 1);
   e->type = CORBA_string_dup ("focus:");
-  e->target = bonobo_object_corba_objref (bonobo_object (accessible_new (object)));
+  e->source = bonobo_object_corba_objref (bonobo_object (accessible_new (object)));
   e->detail1 = 0;
   e->detail2 = 0;
   Accessibility_Registry_notifyEvent (registry, e, &ev);
index ac6c4b8..c03851f 100644 (file)
@@ -14,12 +14,7 @@ extern "C" {
  *
  */
 
-typedef struct _AccessibleEvent {
-  Accessible *source;
-  char *type;
-  char *detail1;
-  char *detail2;
-} AccessibleEvent;
+typedef Accessibility_Event AccessibleEvent;
 
 /*
  *
index 92b6250..3e9d01a 100644 (file)
@@ -31,7 +31,7 @@ module Accessibility
 
   struct Event {
     string type;
-    Accessible target;
+    Accessible source;
     long detail1;
     long detail2;
   };
index 92b6250..3e9d01a 100644 (file)
@@ -31,7 +31,7 @@ module Accessibility
 
   struct Event {
     string type;
-    Accessible target;
+    Accessible source;
     long detail1;
     long detail2;
   };
index 41a4050..c724614 100644 (file)
@@ -70,7 +70,6 @@ impl_accessible_event_notify_event (PortableServer_Servant     servant,
                                     const Accessibility_Event *e,
                                     CORBA_Environment         *ev)
 {
-
   int n;
   int len;
   VoidEventListenerCB cb;
@@ -83,10 +82,10 @@ impl_accessible_event_notify_event (PortableServer_Servant     servant,
       cb =  (VoidEventListenerCB) g_list_nth_data (listener->callbacks, n);
       if (cb)
         {
-          (*cb) (NULL);
+          (*cb) (e);
         }
     }
-  bonobo_object_release_unref (e->target, ev);
+  bonobo_object_release_unref (e->source, ev);
 }
 
 static void
@@ -147,7 +146,7 @@ AccessibleEventListener *
 accessible_event_listener_new ()
 {
     AccessibleEventListener *retval =
-               LISTENER (g_object_new (accessible_event_listener_get_type (), NULL));
+    ACCESSIBLE_EVENT_LISTENER (g_object_new (accessible_event_listener_get_type (), NULL));
     return retval;
 }
 
index c305ae4..6bba3a4 100644 (file)
@@ -134,7 +134,7 @@ application_toolkit_listener (GSignalInvocationHint *signal_hint,
     {
       aobject = atk_implementor_ref_accessible (ATK_IMPLEMENTOR (gobject));
       e->type = CORBA_string_dup (sbuf);
-      e->target = bonobo_object_corba_objref (bonobo_object (accessible_new (aobject)));
+      e->source = bonobo_object_corba_objref (bonobo_object (accessible_new (aobject)));
       e->detail1 = 0;
       e->detail2 = 0;
       Accessibility_EventListener_notifyEvent (the_toolkit_listener, e, &ev);
index 41a4050..c724614 100644 (file)
@@ -70,7 +70,6 @@ impl_accessible_event_notify_event (PortableServer_Servant     servant,
                                     const Accessibility_Event *e,
                                     CORBA_Environment         *ev)
 {
-
   int n;
   int len;
   VoidEventListenerCB cb;
@@ -83,10 +82,10 @@ impl_accessible_event_notify_event (PortableServer_Servant     servant,
       cb =  (VoidEventListenerCB) g_list_nth_data (listener->callbacks, n);
       if (cb)
         {
-          (*cb) (NULL);
+          (*cb) (e);
         }
     }
-  bonobo_object_release_unref (e->target, ev);
+  bonobo_object_release_unref (e->source, ev);
 }
 
 static void
@@ -147,7 +146,7 @@ AccessibleEventListener *
 accessible_event_listener_new ()
 {
     AccessibleEventListener *retval =
-               LISTENER (g_object_new (accessible_event_listener_get_type (), NULL));
+    ACCESSIBLE_EVENT_LISTENER (g_object_new (accessible_event_listener_get_type (), NULL));
     return retval;
 }
 
index d6d6efc..fb0778a 100644 (file)
@@ -74,7 +74,7 @@ impl_notify_event (PortableServer_Servant     servant,
 #ifdef SPI_DEBUG
   fprintf (stderr, "notify %s...\n", e->type);
   fprintf (stderr, "source name: '%s'\n",
-           Accessibility_Accessible__get_name(e->target, ev));
+           Accessibility_Accessible__get_name(e->source, ev));
   if (ev->_major != CORBA_NO_EXCEPTION) {
     fprintf(stderr,
             ("Accessibility app error: exception during event notification: %s\n"),
@@ -82,13 +82,13 @@ impl_notify_event (PortableServer_Servant     servant,
     exit(-1);
   }
   fprintf (stderr, "source is component ? : %s\n",
-           Accessibility_Accessible_queryInterface (e->target,
+           Accessibility_Accessible_queryInterface (e->source,
                                                     "IDL:Accessibility/Component:1.0",
                                                     ev)
            ? "yes" : "no");
 
 #endif
-  bonobo_object_release_unref (e->target, ev);
+  bonobo_object_release_unref (e->source, ev);
 
 }
 
index a257a39..269365a 100644 (file)
@@ -461,7 +461,7 @@ impl_registry_notify_event (PortableServer_Servant servant,
     default:
       break;
     }
-  bonobo_object_release_unref (e->target, ev);
+  bonobo_object_release_unref (e->source, ev);
 }
 
 static void
@@ -489,9 +489,9 @@ registry_notify_listeners ( GList *listeners,
         {
 #ifdef SPI_DEBUG
           fprintf(stderr, "notifying listener #%d\n", n);
-          fprintf(stderr, "event name %s\n", Accessibility_Accessible__get_name(e->target, ev));
+          fprintf(stderr, "event name %s\n", Accessibility_Accessible__get_name(e->source, ev));
 #endif
-          bonobo_object_dup_ref ( e->target, ev);
+          bonobo_object_dup_ref ( e->source, ev);
           Accessibility_EventListener_notifyEvent ((Accessibility_EventListener) ls->listener,
                                                    e,
                                                    ev);
index a257a39..269365a 100644 (file)
@@ -461,7 +461,7 @@ impl_registry_notify_event (PortableServer_Servant servant,
     default:
       break;
     }
-  bonobo_object_release_unref (e->target, ev);
+  bonobo_object_release_unref (e->source, ev);
 }
 
 static void
@@ -489,9 +489,9 @@ registry_notify_listeners ( GList *listeners,
         {
 #ifdef SPI_DEBUG
           fprintf(stderr, "notifying listener #%d\n", n);
-          fprintf(stderr, "event name %s\n", Accessibility_Accessible__get_name(e->target, ev));
+          fprintf(stderr, "event name %s\n", Accessibility_Accessible__get_name(e->source, ev));
 #endif
-          bonobo_object_dup_ref ( e->target, ev);
+          bonobo_object_dup_ref ( e->source, ev);
           Accessibility_EventListener_notifyEvent ((Accessibility_EventListener) ls->listener,
                                                    e,
                                                    ev);
index e79f5b9..c4d29f4 100644 (file)
@@ -64,7 +64,7 @@ main(int argc, char **argv)
         accessible = accessible_new (atko);
         fprintf(stderr, "accessible created.\n");
 
-        e.target = bonobo_object_corba_objref ( bonobo_object (accessible));
+        e.source = bonobo_object_corba_objref ( bonobo_object (accessible));
         e.type = CORBA_string_dup ("focus:");
 
         obj_id = "OAFIID:Accessibility_Registry:proto0.1";
index a0438f2..d1c6df0 100644 (file)
@@ -63,13 +63,17 @@ main(int argc, char **argv)
 }
 
 void
-report_focus_event (void *fp)
+report_focus_event (void *p)
 {
-  fprintf (stderr, "focus\n");
+  AccessibleEvent *ev = (AccessibleEvent *) p;
+  fprintf (stderr, "%s event from %s\n", ev->type,
+           Accessible_getName (&ev->source));
 }
 
 void
-report_button_press (void *fp)
+report_button_press (void *p)
 {
-  fprintf (stderr, "button press\n");
+  AccessibleEvent *ev = (AccessibleEvent *) p;
+  fprintf (stderr, "%s event from %s\n", ev->type,
+           Accessible_getName (&ev->source));
 }