[gtk/a11y/component: 4/4] atspi: Emit bounds-changed when the size changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/a11y/component: 4/4] atspi: Emit bounds-changed when the size changes
- Date: Wed, 14 Oct 2020 01:28:58 +0000 (UTC)
commit c3d92ce79f170b445094017ea9002aaf23930fbe
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 13 21:22:33 2020 -0400
atspi: Emit bounds-changed when the size changes
This is using the newly added platform state
for the widget size.
gtk/a11y/gtkatspicontext.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index 99987d6250..e6766ed411 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -781,6 +781,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,
@@ -953,6 +970,19 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED);
emit_state_changed (self, "focused", state);
}
+
+ if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_SIZE)
+ {
+ double x, y;
+ int width, height;
+
+ gtk_widget_translate_coordinates (widget,
+ GTK_WIDGET (gtk_widget_get_root (widget)),
+ 0, 0, &x, &y);
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
+ emit_bounds_changed (self, (int)x, (int)y, width, height);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]