Add a prompt_id field to struct scene to track the prompt text object.
Update cedit_arange() to use title_id and prompt_id directly instead
of looking up objects by name, which is more robust.
Co-developed-by: Claude <claude@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Some fields may have sensitive information. Allow it to be obscured
during entry, in case someone is watching the display nearby.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
In some cases it is useful to apply the display-related theme elements
without touching the objects. Add an argument to expo_apply_theme() to
support this.
Signed-off-by: Simon Glass <sjg@chromium.org>
The font size of menu items might change, thus requiring the size to
be updated. So it is not correct to mark the items as fixed size.
Drop this code.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is sometimes useful to be able to click on an image (sometimes called
an icon). Allow this within expo and return new click action.
Signed-off-by: Simon Glass <sjg@chromium.org>
For debugging it is sometimes helpful to dump an expo. Add an
implementation of this, writing to a membuf.
Add a MAINTAINERS entry for expo, including this next file.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
The current algorithm spends 10ms or more looking for keyboard input.
Since we expect the frame rate to be 50 or more, it should be OK to only
check once.
Handle the timeout by recording the timestamp of the last key and timing
out the CLI entry after 10ms. This allows an 'Escape' key to work,
rather than it just waiting forever for a terminal sequence that starts
with escape.
Signed-off-by: Simon Glass <sjg@chromium.org>
Keep track of the frame count, i.e. the number of times that
expo_render() has been called since expo_enter_mode() was invoked.
Allow test mode to be enabled (if compiled in) by setting the 'expotest'
environment variable to 1.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
To optimise drawing on the display, provide a new function which draws
only the part of the display which is marked as dirty.
Series-to: concept
Cover-letter:
expo: Continue development of expo with mouse
This series integrates mouse support into expo and starts to build the
infrastructure for drawing the mouse pointer more efficiently (i.e.
without re-rendering the entire scene).
It also adds a few more structs to video_defs.h for position and size.
This is part D.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a flag to indicate that am object must be redrawn. Set this flag
when an object's bounding box changes.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
As a few step towards making rendering more efficient, add support for
tracking video damage within an expo.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Replace the scene_obj_bbox with the common vid_bbox structure to avoid
having the same structs with different names.
Signed-off-by: Simon Glass <sjg@chromium.org>
Store the mouse pointer image and its dimensions in the expo structure
when mouse support is enabled. This avoids repeatedly looking up the
image and calculating its size.
Use struct vid_size to store the mouse pointer dimensions.
Signed-off-by: Simon Glass <sjg@chromium.org>
Sometimes we want to position items individually rather than relying on
the automatic scene layout. Provide a flag for this, expanding the type
to cope.
Also add an assertion that the flags fit in the available space.
Signed-off-by: Simon Glass <sjg@chromium.org>
Implement clicking on an expo, which simply passes it onto the scene.
For now, there are no callers for this function.
Signed-off-by: Simon Glass <sjg@chromium.org>
Popup menus have particular behaviour which needs to be modelled in
the expoact_type enum:
- clicking on a menu item should select it and close the menu
- clicking on a menu should highlight it and open the menu
- clicking on a menu while another menu is open should select the item,
close the menu, then open the other menu
Add actions associated with each of these. These are modelled as
combined actions for simplicity.
Implement the actions in cedit. The general expo support will come
later.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases it is useful to use expo with a mouse (or touchpad). Add
a way to tell expo to find and record a mouse device.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present boxes are not supported in the expo_build format. Also, it is
now possible to draw filled boxes, a recently added feature to the video
API.
Expand the box feature slightly to resolve these two items.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases we want to change the image data used by a scene_img. Add
a function to handle this.
Adjust the BMP function to use a const for the data, since it is not
allowed to change it.
Signed-off-by: Simon Glass <sjg@chromium.org>
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>
Allow the caller to detect when a keypress has actually resulted in a
change of the item that is pointed to.
Signed-off-by: Simon Glass <sjg@chromium.org>
Insets are handled inconsistently at present, since menus use them to
offset the label text, whereas textlines don't. This is done because
menus need the margin to be visible when opened. However this causes an
alignment issue when menus and textlines appear in the same cedit.
Remove the offsets from menus and compensate by adjusting the bounding
boxes used for highlighting and the opened menu.
Line up menu items and textlines vertically and add a style option for
textlines to control how much padding is added.
Add a test to check the positions of objects in a cedit, since this is
more direct than the rendering tests. Add style information so that the
impact can be seen.
Signed-off-by: Simon Glass <sjg@chromium.org>
With fixed coordinates it is difficult to create scenes that can work on
any display size. Add a separate 'requested' bounding box for each
object and sync it when required.
With future work, this will allow scaling the nominal coordinates so
that an expo can be rendered correctly on a wider range of displays.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than drawing the poointer with a hard-coded position elsewhere in
the code, add a field to hold this value.
Move the check for the pointer position up so that the ordering of the
tests matches the order that the fields are dealt with in
scene_menu_arrange()
Signed-off-by: Simon Glass <sjg@chromium.org>
Rename the existing expo_apply_theme() to expo_setup_theme() and adjust
the former so that it applies a theme which has already been read into
the struct. This will make it easier for tests to check theme
adjustments, since they won't have to put them in a node.
Add the white-on-black property into the theme struct while we are.
Signed-off-by: Simon Glass <sjg@chromium.org>
Provide a convenient function which arranges the current scene in an
expo. Make use of this in bootflow_menu
Signed-off-by: Simon Glass <sjg@chromium.org>
It is often necessary to centre objects within the display area. Add a
special position value to indicate this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Within tests it is useful to be able to control rendering of the expo.
Drop the automatic call to expo_render() within expo_poll() and adjust
its callers to handle this instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
Expo normally uses a pointer to show the current item. Add support for
highlighting as well, since this makes it easier for the user to see the
current item.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is useful to be able to edit text, e.g. to allow the user to edit the
environment or the command-line arguments for the OS.
Add the beginnings of an implementation. Future work is needed to finish
this: keypress handling and scrolling. For now it just displays the
text.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add support for left, right and centred alignment for text, in the
horizontal dimension.
Also support top, bottom and centred in the vertical dimension, for the
text object as a whole.
Alignment is not yet implemented for images. It has no meaning for
menus. A textline object uses a text object internally, so alignment
is supported there.
Provide some documentation to explain how objects are positioned.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is useful to be able to draw a box around elements in the menu. Add
support for an unfilled box with a selectable thickness.
Note that there is no support for selecting the colour for any expo
objects yet.
Signed-off-by: Simon Glass <sjg@chromium.org>
Use the measurement info to write each line of text separately, thus
respecting word-wrapping and newlines.
Fix up the comment for scene_obj_render() while we are here.
Since a lineedit does not support alignment, add a special case to just
display the text if there is no measurement. This happens assuming the
lineedit is initially empty.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases dynamic text is needed, e.g. for a menu countdown. Add a
function which handles this, allowing the caller to take control of the
text that is shown on each render.
Signed-off-by: Simon Glass <sjg@chromium.org>
In preparation for adding more text types, refactor the common fields
into a new structure. This will allow common code to be used.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a function to allow the size of an object to be set independently
of its position.
Also add a function to permit the object's bounding box to be set
independently of its dimensions.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present each object has a width and height and the bounding box is
implicit in that.
This is not flexible enough to handle objects which are larger than
their contents might need. For example, when centring a text object we
might want to have it stretch across the whole width of the display even
if the text itself does not need that much space.
Create a new 'dimensions' field and convert the existing width/height
into x1/y1 coordinates.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is more convenient to put strings in an abuf so they can easily be
resized. Adjust the struct accordingly.
Signed-off-by: Simon Glass <sjg@chromium.org>
These coordinates are the top left values, so rename them to x0 and y0
in preparation for changing the width and height to x1 and y1
Signed-off-by: Simon Glass <sjg@chromium.org>
At present we assume that each object is a simple box and that it fills
the whole box.
This is quite limiting for text objects, which we may want to centre
within the box. We need a position within the box where drawing starts.
Rename the scene_dim struct to indicate that it is a bounding box.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add functions to allow a caller to find out the current menu item and to
select a different one.
Update the event handling so that an attempt to change the current item
(e.g. by pressing the up-arrow key) is reported to the caller, since
this may be used to cancel an autoboot timeout.
Signed-off-by: Simon Glass <sjg@chromium.org>
Both bootflow_menu and cedit use similar logic to poll an expo. Move
this into the expo library so the code can be shared.
Update bootflow_menu_run() to return -EPIPE when the user quits without
choosing anything, since -EAGAIN is ambiguous and elsewhere means that
there is no input yet.
Signed-off-by: Simon Glass <sjg@chromium.org>
An expo generally needs to keep track of the keyboard state while it is
running, so move the context into struct expo
Signed-off-by: Simon Glass <sjg@chromium.org>
Coreboot provides the CMOS layout in the tables it passes to U-Boot.
Use that to build an editor for the CMOS settings.
Signed-off-by: Simon Glass <sjg@chromium.org>