Fixes for 98836, 98842, added slots to IDL for ABI freeze.
[platform/core/uifw/at-spi2-atk.git] / libspi / image.c
index 889722a..ca714cd 100644 (file)
@@ -2,7 +2,8 @@
  * AT-SPI - Assistive Technology Service Provider Interface
  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
  *
- * Copyright 2001 Sun Microsystems Inc.
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -32,7 +33,7 @@ spi_image_interface_new (AtkObject *obj)
 {
   SpiImage *new_image = g_object_new (SPI_IMAGE_TYPE, NULL);
 
-  spi_base_construct (SPI_BASE (new_image), obj);
+  spi_base_construct (SPI_BASE (new_image), G_OBJECT(obj));
 
   return new_image;
 }
@@ -42,12 +43,9 @@ get_image_from_servant (PortableServer_Servant servant)
 {
   SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
 
-  if (!object)
-    {
-      return NULL;
-    }
-
-  return ATK_IMAGE (object->atko);
+  g_return_val_if_fail (object, NULL);
+  g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL);
+  return ATK_IMAGE (object->gobj);
 }
 
 static void 
@@ -57,12 +55,15 @@ impl_getImagePosition (PortableServer_Servant servant,
                       CORBA_Environment *ev)
 {
   AtkImage *image = get_image_from_servant (servant);
+  gint ix, iy;
 
   g_return_if_fail (image != NULL);
 
   atk_image_get_image_position (image,
-                               (gint *) x, (gint *) y,
+                               &ix, &iy,
                                (AtkCoordType) coordType);
+  *x = ix;
+  *y = iy;
 }
 
 static void 
@@ -71,11 +72,14 @@ impl_getImageSize (PortableServer_Servant servant,
                   CORBA_Environment *ev)
 {
   AtkImage *image = get_image_from_servant (servant);
-
+  gint iw, ih;
+  
   g_return_if_fail (image != NULL);
 
   atk_image_get_image_size (image,
-                           (gint *) width, (gint *) height);
+                           &iw, &ih);
+  *width = iw;
+  *height = ih;
 }
 
 static Accessibility_BoundingBox
@@ -87,15 +91,20 @@ impl_getImageExtents (PortableServer_Servant servant,
   gint x, y, width, height;
   Accessibility_BoundingBox bbox;
 
+  bbox.x = bbox.y = bbox.width = bbox.height = -1;
+
   image = get_image_from_servant (servant);
 
-  atk_image_get_image_size (image, &width, &height);
-  atk_image_get_image_position (image, &x, &y, coordType);
+  if (image)
+    {
+      atk_image_get_image_size (image, &width, &height);
+      atk_image_get_image_position (image, &x, &y, coordType);
 
-  bbox.x = x;
-  bbox.y = y;
-  bbox.width = width;
-  bbox.height = height;
+      bbox.x = x;
+      bbox.y = y;
+      bbox.width = width;
+      bbox.height = height;
+    }
 
   return bbox;
 }