At present all coordinates are absolute and must fit within the display. This makes it hard to create an expo which can work on any size of display, a key goal of expo.
Add the concept of a nominal size, to which all coordinates conform. Once the real display-size is known, expo can in principle (i.e. with later work) scale the coordinates and objects according. Signed-off-by: Simon Glass <s...@chromium.org> --- boot/bootflow_menu.c | 1 + boot/expo.c | 6 ++++++ include/expo.h | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c index a0437177364..1966e38a6d6 100644 --- a/boot/bootflow_menu.c +++ b/boot/bootflow_menu.c @@ -49,6 +49,7 @@ int bootflow_menu_new(struct expo **expp) ret = expo_new("bootflows", priv, &exp); if (ret) return log_msg_ret("exp", ret); + expo_req_size(exp, 1366, 768); ret = scene_new(exp, "main", MAIN, &scn); if (ret < 0) diff --git a/boot/expo.c b/boot/expo.c index 035c3de5a0a..6f05c47aba6 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -376,3 +376,9 @@ int expo_poll(struct expo *exp, struct expo_action *act) return 0; } + +void expo_req_size(struct expo *exp, int width, int height) +{ + exp->req_width = width; + exp->req_height = height; +} diff --git a/include/expo.h b/include/expo.h index e383872b307..5eb3299284c 100644 --- a/include/expo.h +++ b/include/expo.h @@ -109,6 +109,8 @@ struct expo_theme { * @scene_id: Current scene ID (0 if none) * @next_id: Next ID number to use, for automatic allocation * @action: Action selected by user. At present only one is supported, with the + * @req_width: Requested width of the display + * @req_height: Requested height of the display * type set to EXPOACT_NONE if there is no action * @text_mode: true to use text mode for the menu (no vidconsole) * @popup: true to use popup menus, instead of showing all items @@ -128,6 +130,8 @@ struct expo { uint scene_id; uint next_id; struct expo_action action; + int req_width; + int req_height; bool text_mode; bool popup; bool show_highlight; @@ -1081,4 +1085,17 @@ int cb_expo_build(struct expo **expp); */ int expo_poll(struct expo *exp, struct expo_action *act); +/** + * expo_req_size() - Request a size for the expo display + * + * Set the width and height of the display, so far as requested positions and + * size are concerned. The actual display may be larger or smaller, in which + * case expo scales the objects to fit + * + * @exp: Expo to update + * @width: Requested display width + * @height: Requested display height + */ +void expo_req_size(struct expo *exp, int width, int height); + #endif /*__EXPO_H */ -- 2.43.0 base-commit: e3ced530e543c9f24cbc66430abc6109ce8df015 branch: expa