Unref enum type classes when we're done with them
[platform/upstream/at-spi2-core.git] / atspi / atspi-component.c
index 9cdd896..a375567 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include "atspi-private.h"
+#include "atspi-accessible-private.h"
 
 void
 atspi_rect_free (AtspiRect *rect)
@@ -99,9 +100,10 @@ atspi_component_contains (AtspiComponent *obj,
  *
  * Gets the accessible child at a given coordinate within an #AtspiComponent.
  *
- * Returns: (transfer full): a pointer to an #AtspiAccessible child of the
- *          specified component which contains the point (@x, @y), or NULL if
- *         no child contains the point.
+ * Returns: (nullable) (transfer full): a pointer to an
+ *          #AtspiAccessible child of the specified component which
+ *          contains the point (@x, @y), or NULL if no child contains
+ *          the point.
  **/
 AtspiAccessible *
 atspi_component_get_accessible_at_point (AtspiComponent *obj,
@@ -136,10 +138,21 @@ atspi_component_get_extents (AtspiComponent *obj,
 {
   dbus_uint32_t d_ctype = ctype;
   AtspiRect bbox;
+  AtspiAccessible *accessible;
 
   bbox.x = bbox.y = bbox.width = bbox.height = -1;
   g_return_val_if_fail (obj != NULL, atspi_rect_copy (&bbox));
 
+  accessible = ATSPI_ACCESSIBLE (obj);
+  if (accessible->priv->cache && ctype == ATSPI_COORD_TYPE_SCREEN)
+  {
+    GValue *val = g_hash_table_lookup (accessible->priv->cache, "Component.ScreenExtents");
+    if (val)
+    {
+      return g_value_dup_boxed (val);
+    }
+  }
+
   _atspi_dbus_call (obj, atspi_interface_component, "GetExtents", error, "u=>(iiii)", d_ctype, &bbox);
   return atspi_rect_copy (&bbox);
 }