poppy: center detachable menu text
BUG=b:35585623
BRANCH=None
TEST=reboot and make sure menu is centered in fw screen
CQ-DEPEND=CL:447818
Change-Id: I7ce5063adab978338af18ad2befe65107fdea21f
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/447838
Reviewed-by: Randall Spangler <rspangler@chromium.org>
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index ee81c29..2e4975f 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -332,12 +332,16 @@
static char **m = NULL;
int highlight = 0;
// TODO: We probably want to center this text.
- int xindex = 50;
- int yindex = 30;
+ uint32_t xindex, yindex;
// TODO: need to check for error code.
vb2_get_current_menu_size(current_menu, &m, &size);
+ /* Center block of text */
+ VbExDisplayGetDimension(&xindex, &yindex);
+ xindex = xindex/2 - strlen(m[0])/2;
+ yindex = yindex/2 - size/2;
+
// TODO: do clear screen here.
/* Create menu string */
for (i = 0; i < size; i++) {