mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
expo: Allow highlighting other scene-object types
So far only menus can be highlighted. With the coming addition of text lines we need to be able to highlight other objects. Add a function to determine whether an object can be highlighted. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
408011c2a4
commit
d88edd2bda
2 changed files with 12 additions and 7 deletions
11
boot/scene.c
11
boot/scene.c
|
@ -516,7 +516,7 @@ static void send_key_obj(struct scene *scn, struct scene_obj *obj, int key,
|
||||||
sibling)) {
|
sibling)) {
|
||||||
obj = list_entry(obj->sibling.prev,
|
obj = list_entry(obj->sibling.prev,
|
||||||
struct scene_obj, sibling);
|
struct scene_obj, sibling);
|
||||||
if (obj->type == SCENEOBJT_MENU) {
|
if (scene_obj_can_highlight(obj)) {
|
||||||
event->type = EXPOACT_POINT_OBJ;
|
event->type = EXPOACT_POINT_OBJ;
|
||||||
event->select.id = obj->id;
|
event->select.id = obj->id;
|
||||||
log_debug("up to obj %d\n", event->select.id);
|
log_debug("up to obj %d\n", event->select.id);
|
||||||
|
@ -528,7 +528,7 @@ static void send_key_obj(struct scene *scn, struct scene_obj *obj, int key,
|
||||||
while (!list_is_last(&obj->sibling, &scn->obj_head)) {
|
while (!list_is_last(&obj->sibling, &scn->obj_head)) {
|
||||||
obj = list_entry(obj->sibling.next, struct scene_obj,
|
obj = list_entry(obj->sibling.next, struct scene_obj,
|
||||||
sibling);
|
sibling);
|
||||||
if (obj->type == SCENEOBJT_MENU) {
|
if (scene_obj_can_highlight(obj)) {
|
||||||
event->type = EXPOACT_POINT_OBJ;
|
event->type = EXPOACT_POINT_OBJ;
|
||||||
event->select.id = obj->id;
|
event->select.id = obj->id;
|
||||||
log_debug("down to obj %d\n", event->select.id);
|
log_debug("down to obj %d\n", event->select.id);
|
||||||
|
@ -537,7 +537,7 @@ static void send_key_obj(struct scene *scn, struct scene_obj *obj, int key,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BKEY_SELECT:
|
case BKEY_SELECT:
|
||||||
if (obj->type == SCENEOBJT_MENU) {
|
if (scene_obj_can_highlight(obj)) {
|
||||||
event->type = EXPOACT_OPEN;
|
event->type = EXPOACT_OPEN;
|
||||||
event->select.id = obj->id;
|
event->select.id = obj->id;
|
||||||
log_debug("open obj %d\n", event->select.id);
|
log_debug("open obj %d\n", event->select.id);
|
||||||
|
@ -685,12 +685,9 @@ void scene_highlight_first(struct scene *scn)
|
||||||
struct scene_obj *obj;
|
struct scene_obj *obj;
|
||||||
|
|
||||||
list_for_each_entry(obj, &scn->obj_head, sibling) {
|
list_for_each_entry(obj, &scn->obj_head, sibling) {
|
||||||
switch (obj->type) {
|
if (scene_obj_can_highlight(obj)) {
|
||||||
case SCENEOBJT_MENU:
|
|
||||||
scene_set_highlight_id(scn, obj->id);
|
scene_set_highlight_id(scn, obj->id);
|
||||||
return;
|
return;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,8 @@ enum scene_obj_t {
|
||||||
SCENEOBJT_NONE = 0,
|
SCENEOBJT_NONE = 0,
|
||||||
SCENEOBJT_IMAGE,
|
SCENEOBJT_IMAGE,
|
||||||
SCENEOBJT_TEXT,
|
SCENEOBJT_TEXT,
|
||||||
|
|
||||||
|
/* types from here on can be highlighted */
|
||||||
SCENEOBJT_MENU,
|
SCENEOBJT_MENU,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,6 +205,12 @@ struct scene_obj {
|
||||||
struct list_head sibling;
|
struct list_head sibling;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* object can be highlighted when moving around expo */
|
||||||
|
static inline bool scene_obj_can_highlight(const struct scene_obj *obj)
|
||||||
|
{
|
||||||
|
return obj->type >= SCENEOBJT_MENU;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct scene_obj_img - information about an image object in a scene
|
* struct scene_obj_img - information about an image object in a scene
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue