mirror of
https://github.com/brl/mutter.git
synced 2025-01-26 03:18:56 +00:00
cally: Avoid access to stage through ClutterEvent
Pass the stage explicitly, in order to avoid having to peek to it through the event. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
parent
6fd7f95ed3
commit
043ff8f98f
@ -278,12 +278,12 @@ insert_hf (gpointer key, gpointer value, gpointer data)
|
||||
* char
|
||||
*/
|
||||
static gunichar
|
||||
check_key_visibility (ClutterEvent *event)
|
||||
check_key_visibility (ClutterStage *stage)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
ClutterActor *focus;
|
||||
|
||||
focus = clutter_stage_get_key_focus (clutter_event_get_stage (event));
|
||||
focus = clutter_stage_get_key_focus (stage);
|
||||
accessible = clutter_actor_get_accessible (focus);
|
||||
|
||||
g_return_val_if_fail (accessible != NULL, 0);
|
||||
@ -307,7 +307,8 @@ check_key_visibility (ClutterEvent *event)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cally_snoop_key_event (ClutterKeyEvent *key)
|
||||
cally_snoop_key_event (ClutterStage *stage,
|
||||
ClutterKeyEvent *key)
|
||||
{
|
||||
ClutterEvent *event = (ClutterEvent *) key;
|
||||
AtkKeyEventStruct *key_event = NULL;
|
||||
@ -323,7 +324,7 @@ cally_snoop_key_event (ClutterKeyEvent *key)
|
||||
GHashTable *new_hash = g_hash_table_new (NULL, NULL);
|
||||
|
||||
g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
|
||||
password_char = check_key_visibility (event);
|
||||
password_char = check_key_visibility (stage);
|
||||
key_event = atk_key_event_from_clutter_event_key (key, password_char);
|
||||
/* func data is inside the hash table */
|
||||
consumed = g_hash_table_foreach_steal (new_hash, notify_hf, key_event) > 0;
|
||||
|
@ -65,6 +65,7 @@ GType cally_util_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void _cally_util_override_atk_util (void);
|
||||
|
||||
gboolean cally_snoop_key_event (ClutterKeyEvent *key);
|
||||
gboolean cally_snoop_key_event (ClutterStage *stage,
|
||||
ClutterKeyEvent *key);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -687,7 +687,7 @@ emit_event (ClutterStage *stage,
|
||||
{
|
||||
if (event->type == CLUTTER_KEY_PRESS ||
|
||||
event->type == CLUTTER_KEY_RELEASE)
|
||||
cally_snoop_key_event ((ClutterKeyEvent *) event);
|
||||
cally_snoop_key_event (stage, (ClutterKeyEvent *) event);
|
||||
|
||||
clutter_stage_emit_event (stage, event);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user