expo: Allow the nominal display-size to be selected
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 <sjg@chromium.org>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,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
|
||||
@@ -131,6 +133,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;
|
||||
@@ -1084,4 +1088,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 */
|
||||
|
||||
Reference in New Issue
Block a user