forked from AuroraMiddleware/gtk
atspi: Emit bounds-changed
This is using the new bounds_change vfunc in GtkATContext.
This commit is contained in:
parent
75a0bef921
commit
04a51837f7
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user