clutter/actor: Emit accessibility states changes directly
Instead of making CallyActor listen to notify, adding an extra overhead Helps with merging Cally inside of Clutter Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
This commit is contained in:
parent
288ad7206b
commit
e6a394ca10
2 changed files with 36 additions and 49 deletions
|
@ -113,8 +113,6 @@ static gboolean cally_actor_grab_focus (AtkComponent *component);
|
|||
/* Misc functions */
|
||||
static void cally_actor_notify_clutter (GObject *obj,
|
||||
GParamSpec *pspec);
|
||||
static void cally_actor_real_notify_clutter (GObject *obj,
|
||||
GParamSpec *pspec);
|
||||
|
||||
struct _CallyActorPrivate
|
||||
{
|
||||
|
@ -204,8 +202,6 @@ cally_actor_class_init (CallyActorClass *klass)
|
|||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
klass->notify_clutter = cally_actor_real_notify_clutter;
|
||||
|
||||
/* GObject */
|
||||
gobject_class->finalize = cally_actor_finalize;
|
||||
|
||||
|
@ -619,48 +615,3 @@ cally_actor_notify_clutter (GObject *obj,
|
|||
if (klass->notify_clutter)
|
||||
klass->notify_clutter (obj, pspec);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is a signal handler for notify signal which gets emitted
|
||||
* when a property changes value on the ClutterActor associated with a CallyActor
|
||||
*
|
||||
* It constructs an AtkPropertyValues structure and emits a "property_changed"
|
||||
* signal which causes the user specified AtkPropertyChangeHandler
|
||||
* to be called.
|
||||
*/
|
||||
static void
|
||||
cally_actor_real_notify_clutter (GObject *obj,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterActor* actor = CLUTTER_ACTOR (obj);
|
||||
AtkObject* atk_obj = clutter_actor_get_accessible (CLUTTER_ACTOR(obj));
|
||||
AtkState state;
|
||||
gboolean value;
|
||||
|
||||
if (g_strcmp0 (pspec->name, "visible") == 0)
|
||||
{
|
||||
state = ATK_STATE_VISIBLE;
|
||||
value = clutter_actor_is_visible (actor);
|
||||
}
|
||||
else if (g_strcmp0 (pspec->name, "mapped") == 0)
|
||||
{
|
||||
/* Clones may temporarily map an actor in order to
|
||||
* paint it; we don't want this to generate an ATK
|
||||
* state change
|
||||
*/
|
||||
if (clutter_actor_is_painting_unmapped (actor))
|
||||
return;
|
||||
|
||||
state = ATK_STATE_SHOWING;
|
||||
value = clutter_actor_is_mapped (actor);
|
||||
}
|
||||
else if (g_strcmp0 (pspec->name, "reactive") == 0)
|
||||
{
|
||||
state = ATK_STATE_SENSITIVE;
|
||||
value = clutter_actor_get_reactive (actor);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
atk_object_notify_state_change (atk_obj, state, value);
|
||||
}
|
||||
|
|
|
@ -1412,6 +1412,7 @@ clutter_actor_real_map (ClutterActor *self)
|
|||
{
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterActor *iter;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_assert (!clutter_actor_is_mapped (self));
|
||||
|
||||
|
@ -1448,6 +1449,12 @@ clutter_actor_real_map (ClutterActor *self)
|
|||
*/
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAPPED]);
|
||||
|
||||
accessible = clutter_actor_get_accessible (self);
|
||||
if (accessible && !clutter_actor_is_painting_unmapped (self))
|
||||
atk_object_notify_state_change (accessible,
|
||||
ATK_STATE_SHOWING,
|
||||
TRUE);
|
||||
|
||||
for (iter = priv->first_child;
|
||||
iter != NULL;
|
||||
iter = iter->priv->next_sibling)
|
||||
|
@ -1547,6 +1554,7 @@ clutter_actor_real_unmap (ClutterActor *self)
|
|||
{
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
ClutterActor *iter;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_assert (clutter_actor_is_mapped (self));
|
||||
|
||||
|
@ -1578,6 +1586,12 @@ clutter_actor_real_unmap (ClutterActor *self)
|
|||
*/
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_MAPPED]);
|
||||
|
||||
accessible = clutter_actor_get_accessible (self);
|
||||
if (accessible && !clutter_actor_is_painting_unmapped (self))
|
||||
atk_object_notify_state_change (accessible,
|
||||
ATK_STATE_SHOWING,
|
||||
FALSE);
|
||||
|
||||
if (priv->n_pointers > 0)
|
||||
{
|
||||
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
|
||||
|
@ -1711,6 +1725,7 @@ void
|
|||
clutter_actor_show (ClutterActor *self)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
|
@ -1748,6 +1763,12 @@ clutter_actor_show (ClutterActor *self)
|
|||
g_signal_emit (self, actor_signals[SHOW], 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]);
|
||||
|
||||
accessible = clutter_actor_get_accessible (self);
|
||||
if (accessible)
|
||||
atk_object_notify_state_change (accessible,
|
||||
ATK_STATE_VISIBLE,
|
||||
TRUE);
|
||||
|
||||
if (priv->parent != NULL)
|
||||
clutter_actor_queue_redraw (self);
|
||||
|
||||
|
@ -1802,6 +1823,7 @@ void
|
|||
clutter_actor_hide (ClutterActor *self)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
|
@ -1839,6 +1861,13 @@ clutter_actor_hide (ClutterActor *self)
|
|||
g_signal_emit (self, actor_signals[HIDE], 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]);
|
||||
|
||||
accessible = clutter_actor_get_accessible (self);
|
||||
if (accessible)
|
||||
atk_object_notify_state_change (accessible,
|
||||
ATK_STATE_VISIBLE,
|
||||
FALSE);
|
||||
|
||||
|
||||
if (priv->parent != NULL && priv->needs_allocation)
|
||||
clutter_actor_queue_redraw (priv->parent);
|
||||
else
|
||||
|
@ -11782,6 +11811,7 @@ clutter_actor_set_reactive (ClutterActor *actor,
|
|||
gboolean reactive)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
|
@ -11797,6 +11827,12 @@ clutter_actor_set_reactive (ClutterActor *actor,
|
|||
|
||||
g_object_notify_by_pspec (G_OBJECT (actor), obj_props[PROP_REACTIVE]);
|
||||
|
||||
accessible = clutter_actor_get_accessible (actor);
|
||||
if (accessible)
|
||||
atk_object_notify_state_change (accessible,
|
||||
ATK_STATE_SENSITIVE,
|
||||
reactive);
|
||||
|
||||
if (!clutter_actor_get_reactive (actor) && priv->n_pointers > 0)
|
||||
{
|
||||
ClutterActor *stage = _clutter_actor_get_stage_internal (actor);
|
||||
|
|
Loading…
Reference in a new issue