aboutsummaryrefslogtreecommitdiffstats
path: root/boot/scene_menu.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2024-10-14 16:31:55 -0600
committerSimon Glass <sjg@chromium.org>2024-10-18 14:10:22 -0600
commit54eca1d39bc980a7e99af53a5b32443d5774b1a0 (patch)
tree5c916e05eba224de4602a072a2ed2e3eeff67ac3 /boot/scene_menu.c
parent18a85cf7b5da3b8fabfed809cc972f0b58279620 (diff)
downloadu-boot-54eca1d39bc980a7e99af53a5b32443d5774b1a0.tar.gz
expo: Place menu items to the right of all labels
At present a fixed position is used for menu items, 200 pixels to the right of the left side of the labels. This means that a menu item with a very long label may overlap the items. It seems better to calculate the maximum label width and then place the items to the right of all of them. To implement this, add a new struct to containing arrangement information. Calculate it before doing the actual arrangement. Add a new style item which sets the amount of space from the right side of the labels to left side of the items. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/scene_menu.c')
-rw-r--r--boot/scene_menu.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/boot/scene_menu.c b/boot/scene_menu.c
index 80bd7457cb1..c331f6670cc 100644
--- a/boot/scene_menu.c
+++ b/boot/scene_menu.c
@@ -168,7 +168,8 @@ int scene_menu_calc_dims(struct scene_obj_menu *menu)
return 0;
}
-int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu)
+int scene_menu_arrange(struct scene *scn, struct expo_arrange_info *arr,
+ struct scene_obj_menu *menu)
{
const bool open = menu->obj.flags & SCENEOF_OPEN;
struct expo *exp = scn->expo;
@@ -182,16 +183,18 @@ int scene_menu_arrange(struct scene *scn, struct scene_obj_menu *menu)
x = menu->obj.dim.x;
y = menu->obj.dim.y;
if (menu->title_id) {
+ int width;
+
ret = scene_obj_set_pos(scn, menu->title_id, menu->obj.dim.x, y);
if (ret < 0)
return log_msg_ret("tit", ret);
- ret = scene_obj_get_hw(scn, menu->title_id, NULL);
+ ret = scene_obj_get_hw(scn, menu->title_id, &width);
if (ret < 0)
return log_msg_ret("hei", ret);
if (stack)
- x += 200;
+ x += arr->label_width + theme->menu_title_margin_x;
else
y += ret * 2;
}