2001-12-10 Michael Meeks <michael@ximian.com>
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_component.c
index 103a69f..f644da3 100644 (file)
  * Returns: (no return code implemented yet).
  *
  **/
-int
+void
 AccessibleComponent_ref (AccessibleComponent *obj)
 {
   cspi_object_ref (obj);
-  return 0;
 }
 
 /**
@@ -31,11 +30,10 @@ AccessibleComponent_ref (AccessibleComponent *obj)
  * Returns: (no return code implemented yet).
  *
  **/
-int
+void
 AccessibleComponent_unref (AccessibleComponent *obj)
 {
   cspi_object_unref (obj);
-  return 0;
 }
 
 /**
@@ -57,6 +55,8 @@ AccessibleComponent_contains (AccessibleComponent *obj,
                               long int y,
                               AccessibleCoordType ctype)
 {
+  cspi_return_val_if_fail (obj != NULL, FALSE);
+
   return Accessibility_Component_contains (CSPI_OBJREF (obj),
                                            (CORBA_long) x,
                                            (CORBA_long) y,
@@ -85,11 +85,13 @@ AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj,
 {
   Accessibility_Accessible child;
 
-  child = Accessibility_Component_getAccessibleAtPoint(CSPI_OBJREF (obj),
-                                                       (CORBA_long) x,
-                                                       (CORBA_long) y,
-                                                       ctype,
-                                                       cspi_ev ());
+  cspi_return_val_if_fail (obj != NULL, NULL);
+
+  child = Accessibility_Component_getAccessibleAtPoint (CSPI_OBJREF (obj),
+                                                       (CORBA_long) x,
+                                                       (CORBA_long) y,
+                                                       ctype,
+                                                       cspi_ev ());
   return cspi_object_add (child);
 }
 
@@ -114,19 +116,24 @@ AccessibleComponent_getExtents (AccessibleComponent *obj,
                                 long int *height,
                                 AccessibleCoordType ctype)
 {
-  CORBA_long cx, cy, cw, ch;   
-  Accessibility_Component_getExtents (CSPI_OBJREF (obj),
-                                      &cx,
-                                      &cy,
-                                      &cw,
-                                      &ch,
-                                     ctype,
-                                     cspi_ev ());
-  cspi_warn_ev (cspi_ev (), "AccessibleComponent_getExtents");
-  *x = (long) cx;
-  *y = (long) cy;
-  *width = (long) cw;
-  *height = (long) ch;
+  Accessibility_BoundingBox bbox;
+
+  cspi_return_if_fail (obj != NULL);
+
+  bbox = Accessibility_Component_getExtents (CSPI_OBJREF (obj),
+                                            ctype,
+                                            cspi_ev ());
+  if (cspi_check_ev ("AccessibleComponent_getExtents"))
+    {
+      *x = *y = *width = *height = 0;    
+    }
+  else
+    {
+      *x = bbox.x;
+      *y = bbox.y;
+      *width = bbox.width;
+      *height = bbox.height;
+    }
 }
 
 /**
@@ -189,8 +196,8 @@ AccessibleComponent_getLayer (AccessibleComponent *obj)
   AccessibleComponentLayer retval;
   
   zlayer = Accessibility_Component_getLayer (CSPI_OBJREF (obj),
-                                             cspi_ev ());
-  switch (retval)
+                                            cspi_ev ());
+  switch (zlayer)
     {
     case Accessibility_LAYER_BACKGROUND:
       retval = SPI_LAYER_BACKGROUND;
@@ -212,6 +219,7 @@ AccessibleComponent_getLayer (AccessibleComponent *obj)
       break;
     default:
       retval = SPI_LAYER_INVALID;
+      break;
     }
   return retval;
 }