summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-08-15 02:18:42 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-08-18 20:16:27 +0200
commit4b5ed8630c5ae9ef37884c4199da8463b7e5a127 (patch)
treed9093f1f5fa7462eadca0ca278f3141b462f7c34
parent57af1951823d6e855e2e37bb345070913449653d (diff)
downloadatk-4b5ed8630c5ae9ef37884c4199da8463b7e5a127.tar.gz
atksocket: make get_extents return parent extents by default
The socket itself will usually just inherit the parent's extents, so this makes a convenient good default. As discussed on https://mail.gnome.org/archives/gnome-accessibility-devel/2019-August/msg00001.html
-rw-r--r--atk/atksocket.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/atk/atksocket.c b/atk/atksocket.c
index c8e03f7..b6ca43d 100644
--- a/atk/atksocket.c
+++ b/atk/atksocket.c
@@ -56,6 +56,13 @@ static void atk_socket_finalize (GObject *obj);
static void atk_component_interface_init (AtkComponentIface *iface);
+static void atk_socket_component_real_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type);
+
G_DEFINE_TYPE_WITH_CODE (AtkSocket, atk_socket, ATK_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
@@ -94,6 +101,7 @@ atk_socket_finalize (GObject *_obj)
static void
atk_component_interface_init (AtkComponentIface *iface)
{
+ iface->get_extents = atk_socket_component_real_get_extents;
}
/**
@@ -162,3 +170,30 @@ atk_socket_is_occupied (AtkSocket* obj)
return (obj->embedded_plug_id != NULL);
}
+
+static void
+atk_socket_component_real_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ AtkObject *parent = atk_object_get_parent (ATK_OBJECT (component));
+
+ if (parent == NULL || !ATK_IS_COMPONENT (parent))
+ {
+ if (x)
+ *x = -1;
+ if (y)
+ *y = -1;
+ if (width)
+ *width = -1;
+ if (height)
+ *height = -1;
+
+ return;
+ }
+
+ atk_component_get_extents (ATK_COMPONENT (parent), x, y, width, height, coord_type);
+}