Fixed bug #517761, Collection match rules not working for attributes.
[platform/core/uifw/at-spi2-atk.git] / libspi / image.c
index 8a30cb7..34340c6 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
@@ -54,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 
@@ -68,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
@@ -84,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;
 }
@@ -118,6 +130,27 @@ impl__get_imageDescription (PortableServer_Servant servant,
     }
 }
 
+static CORBA_string 
+impl__get_imageLocale (PortableServer_Servant servant,
+                      CORBA_Environment     *ev)
+{
+  const char *rv;
+  AtkImage   *image = get_image_from_servant (servant);
+
+  g_return_val_if_fail (image != NULL, CORBA_string_dup ("C"));
+
+  rv = atk_image_get_image_locale (image);
+
+  if (rv)
+    {
+      return CORBA_string_dup (rv);
+    }
+  else
+    {
+      return CORBA_string_dup ("C");
+    }
+}
+
 static void
 spi_image_class_init (SpiImageClass *klass)
 {
@@ -128,6 +161,7 @@ spi_image_class_init (SpiImageClass *klass)
   epv->getImageSize          = impl_getImageSize;
   epv->getImageExtents       = impl_getImageExtents;
   epv->_get_imageDescription = impl__get_imageDescription;
+  epv->_get_imageLocale      = impl__get_imageLocale;
 }
 
 static void
@@ -138,4 +172,4 @@ spi_image_init (SpiImage *image)
 BONOBO_TYPE_FUNC_FULL (SpiImage,
                       Accessibility_Image,
                       SPI_TYPE_BASE,
-                      spi_image);
+                      spi_image)