st/focus-manager: Use ClutterEvent getter methods in StFocusManager
Also make StFocusManager keep track of the ClutterStage it is relative to, in order to avoid the ClutterStage event getter that is going away. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
This commit is contained in:
parent
aac0e0e802
commit
a95addd772
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
struct _StFocusManagerPrivate
|
struct _StFocusManagerPrivate
|
||||||
{
|
{
|
||||||
|
ClutterStage *stage;
|
||||||
GHashTable *groups;
|
GHashTable *groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -79,10 +80,10 @@ st_focus_manager_stage_event (ClutterActor *stage,
|
|||||||
gboolean wrap_around = FALSE;
|
gboolean wrap_around = FALSE;
|
||||||
ClutterActor *focused, *group;
|
ClutterActor *focused, *group;
|
||||||
|
|
||||||
if (event->type != CLUTTER_KEY_PRESS)
|
if (clutter_event_type (event) != CLUTTER_KEY_PRESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
switch (event->key.keyval)
|
switch (clutter_event_get_key_symbol (event))
|
||||||
{
|
{
|
||||||
case CLUTTER_KEY_Up:
|
case CLUTTER_KEY_Up:
|
||||||
direction = ST_DIR_UP;
|
direction = ST_DIR_UP;
|
||||||
@ -97,7 +98,7 @@ st_focus_manager_stage_event (ClutterActor *stage,
|
|||||||
direction = ST_DIR_RIGHT;
|
direction = ST_DIR_RIGHT;
|
||||||
break;
|
break;
|
||||||
case CLUTTER_KEY_Tab:
|
case CLUTTER_KEY_Tab:
|
||||||
if (event->key.modifier_state & CLUTTER_SHIFT_MASK)
|
if (clutter_event_get_state (event) & CLUTTER_SHIFT_MASK)
|
||||||
direction = ST_DIR_TAB_BACKWARD;
|
direction = ST_DIR_TAB_BACKWARD;
|
||||||
else
|
else
|
||||||
direction = ST_DIR_TAB_FORWARD;
|
direction = ST_DIR_TAB_FORWARD;
|
||||||
@ -144,6 +145,7 @@ st_focus_manager_get_for_stage (ClutterStage *stage)
|
|||||||
if (!manager)
|
if (!manager)
|
||||||
{
|
{
|
||||||
manager = g_object_new (ST_TYPE_FOCUS_MANAGER, NULL);
|
manager = g_object_new (ST_TYPE_FOCUS_MANAGER, NULL);
|
||||||
|
manager->priv->stage = stage;
|
||||||
g_object_set_data_full (G_OBJECT (stage), "st-focus-manager",
|
g_object_set_data_full (G_OBJECT (stage), "st-focus-manager",
|
||||||
manager, g_object_unref);
|
manager, g_object_unref);
|
||||||
|
|
||||||
@ -246,11 +248,9 @@ gboolean
|
|||||||
st_focus_manager_navigate_from_event (StFocusManager *manager,
|
st_focus_manager_navigate_from_event (StFocusManager *manager,
|
||||||
ClutterEvent *event)
|
ClutterEvent *event)
|
||||||
{
|
{
|
||||||
ClutterActor *stage;
|
if (clutter_event_type (event) != CLUTTER_KEY_PRESS)
|
||||||
|
|
||||||
if (event->type != CLUTTER_KEY_PRESS)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
stage = CLUTTER_ACTOR (event->key.stage);
|
return st_focus_manager_stage_event (CLUTTER_ACTOR (manager->priv->stage),
|
||||||
return st_focus_manager_stage_event (stage, event, manager);
|
event, manager);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user