[gtk/a11y/component: 183/183] atspi: Emit bounds-changed
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y/component: 183/183] atspi: Emit bounds-changed
- Date: Mon, 19 Oct 2020 16:09:48 +0000 (UTC)
commit a7e40ad8d753e8c05dcff9ca9781bb4668dea326
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 19 11:45:21 2020 -0400
atspi: Emit bounds-changed
This is using the new bounds_change vfunc in GtkATContext.
gtk/a11y/gtkatspicontext.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index 53589b9466..8d378685a9 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -778,6 +778,23 @@ emit_property_changed (GtkAtSpiContext *self,
NULL);
}
+static void
+emit_bounds_changed (GtkAtSpiContext *self,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ g_dbus_connection_emit_signal (self->connection,
+ NULL,
+ self->context_path,
+ "org.a11y.atspi.Event.Object",
+ "BoundsChanged",
+ g_variant_new ("(siiva{sv})",
+ "", 0, 0, g_variant_new ("(iiii)", x, y, width, height),
NULL),
+ NULL);
+}
+
static void
gtk_at_spi_context_state_change (GtkATContext *ctx,
GtkAccessibleStateChange changed_states,
@@ -971,6 +988,36 @@ gtk_at_spi_context_platform_change (GtkATContext *ctx,
emit_state_changed (self, "focused", state);
}
}
+
+static void
+gtk_at_spi_context_bounds_change (GtkATContext *ctx)
+{
+ GtkAtSpiContext *self = GTK_AT_SPI_CONTEXT (ctx);
+ GtkAccessible *accessible = gtk_at_context_get_accessible (ctx);
+ GtkWidget *widget;
+ GtkWidget *parent;
+ double x, y;
+ int width, height;
+
+ if (!GTK_IS_WIDGET (accessible))
+ return;
+
+ widget = GTK_WIDGET (accessible);
+ if (!gtk_widget_get_realized (widget))
+ return;
+
+ parent = gtk_widget_get_parent (widget);
+
+ if (parent)
+ gtk_widget_translate_coordinates (widget, parent, 0., 0., &x, &y);
+ else
+ x = y = 0.;
+
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
+
+ emit_bounds_changed (self, (int)x, (int)y, width, height);
+}
/* }}} */
/* {{{ D-Bus Registration */
static void
@@ -1256,6 +1303,7 @@ gtk_at_spi_context_class_init (GtkAtSpiContextClass *klass)
context_class->state_change = gtk_at_spi_context_state_change;
context_class->platform_change = gtk_at_spi_context_platform_change;
+ context_class->bounds_change = gtk_at_spi_context_bounds_change;
obj_props[PROP_BUS_ADDRESS] =
g_param_spec_string ("bus-address", NULL, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]