|
|
79df40 |
From 19a03c1c2df7e510d3fa1b25eec7840cc5816dfe Mon Sep 17 00:00:00 2001
|
|
|
79df40 |
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
|
|
79df40 |
Date: Thu, 25 Jul 2019 01:02:34 +0200
|
|
|
79df40 |
Subject: [PATCH 13/28] cally/stage: Set the keyfocus to NULL if the stage is
|
|
|
79df40 |
focused
|
|
|
79df40 |
|
|
|
79df40 |
By definition when the key focus is set to NULL we assume that the stage has it,
|
|
|
79df40 |
so in such case avoid keeping track of the stage pointer and setting a weak ref
|
|
|
79df40 |
on it, as it might only cause double-free errors during the stage disposition,
|
|
|
79df40 |
that would lead (via atk) to a cally stage disposition as well.
|
|
|
79df40 |
|
|
|
79df40 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
|
|
|
79df40 |
---
|
|
|
79df40 |
clutter/clutter/cally/cally-stage.c | 3 +++
|
|
|
79df40 |
1 file changed, 3 insertions(+)
|
|
|
79df40 |
|
|
|
79df40 |
diff --git a/clutter/clutter/cally/cally-stage.c b/clutter/clutter/cally/cally-stage.c
|
|
|
79df40 |
index 7c100aabf..5638c1bb1 100644
|
|
|
79df40 |
--- a/clutter/clutter/cally/cally-stage.c
|
|
|
79df40 |
+++ b/clutter/clutter/cally/cally-stage.c
|
|
|
79df40 |
@@ -101,60 +101,63 @@ cally_stage_init (CallyStage *cally_stage)
|
|
|
79df40 |
*/
|
|
|
79df40 |
AtkObject*
|
|
|
79df40 |
cally_stage_new (ClutterActor *actor)
|
|
|
79df40 |
{
|
|
|
79df40 |
GObject *object = NULL;
|
|
|
79df40 |
AtkObject *accessible = NULL;
|
|
|
79df40 |
|
|
|
79df40 |
g_return_val_if_fail (CLUTTER_IS_STAGE (actor), NULL);
|
|
|
79df40 |
|
|
|
79df40 |
object = g_object_new (CALLY_TYPE_STAGE, NULL);
|
|
|
79df40 |
|
|
|
79df40 |
accessible = ATK_OBJECT (object);
|
|
|
79df40 |
atk_object_initialize (accessible, actor);
|
|
|
79df40 |
|
|
|
79df40 |
return accessible;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
cally_stage_notify_key_focus_cb (ClutterStage *stage,
|
|
|
79df40 |
GParamSpec *pspec,
|
|
|
79df40 |
CallyStage *self)
|
|
|
79df40 |
{
|
|
|
79df40 |
ClutterActor *key_focus = NULL;
|
|
|
79df40 |
AtkObject *new = NULL;
|
|
|
79df40 |
|
|
|
79df40 |
if (self->priv->active == FALSE)
|
|
|
79df40 |
return;
|
|
|
79df40 |
|
|
|
79df40 |
key_focus = clutter_stage_get_key_focus (stage);
|
|
|
79df40 |
|
|
|
79df40 |
+ if (key_focus == CLUTTER_ACTOR (stage))
|
|
|
79df40 |
+ key_focus = NULL;
|
|
|
79df40 |
+
|
|
|
79df40 |
if (key_focus != self->priv->key_focus)
|
|
|
79df40 |
{
|
|
|
79df40 |
AtkObject *old = NULL;
|
|
|
79df40 |
|
|
|
79df40 |
if (self->priv->key_focus != NULL)
|
|
|
79df40 |
{
|
|
|
79df40 |
g_object_remove_weak_pointer (G_OBJECT (self->priv->key_focus),
|
|
|
79df40 |
(gpointer *) &self->priv->key_focus);
|
|
|
79df40 |
old = clutter_actor_get_accessible (self->priv->key_focus);
|
|
|
79df40 |
}
|
|
|
79df40 |
else
|
|
|
79df40 |
old = clutter_actor_get_accessible (CLUTTER_ACTOR (stage));
|
|
|
79df40 |
|
|
|
79df40 |
atk_object_notify_state_change (old,
|
|
|
79df40 |
ATK_STATE_FOCUSED,
|
|
|
79df40 |
FALSE);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
/* we keep notifying the focus gain without checking previous
|
|
|
79df40 |
* key-focus to avoid some missing events due timing
|
|
|
79df40 |
*/
|
|
|
79df40 |
self->priv->key_focus = key_focus;
|
|
|
79df40 |
|
|
|
79df40 |
if (key_focus != NULL)
|
|
|
79df40 |
{
|
|
|
79df40 |
/* ensure that if the key focus goes away, the field inside
|
|
|
79df40 |
* CallyStage is reset. see bug:
|
|
|
79df40 |
*
|
|
|
79df40 |
* https://bugzilla.gnome.org/show_bug.cgi?id=692706
|
|
|
79df40 |
*
|
|
|
79df40 |
--
|
|
|
79df40 |
2.26.2
|
|
|
79df40 |
|