
U-Boot’s ‘expo’ toolkit is used for creating user interfaces, such as the configuration editor (cedit
) and graphical boot menus (bootflow menu
). Previously, user interaction with expo scenes was limited to the keyboard.
A recent 23-patch series introduces support for mouse and touchpad interaction.
New Input Handling
For devices where a mouse or touchpad is available, keyboard-only navigation can be inefficient. This update is intended to improve user interaction, particularly within complex screens like the configuration editor.
The core of this update is a new expo_send_click()
function, which is designed to work similarly to the existing expo_send_key()
function for processing user input.
The expo framework separates the processing of an event (like a click or keypress) from the handling of the resulting action. This series maintains that design, which allows expo to be integrated into different event loops. If a mouse is detected, expo will enable it by default.
Implementation Details
To enable mouse clicks, the framework required a method to determine which UI element exists at a specific (x, y)
coordinate. This was implemented in several stages:
- Coordinate Checking: New functions, such as
scene_menu_within()
andscene_textline_within()
, have been added. These check if a given coordinate is within the bounding box of a menu item or an editable text field. - Scene-Level Clicks: The logic was then extended to the scene level, allowing a click to be routed to the correct object within the current scene. This includes handling for popup menus.
- Input Polling: The main
expo_poll()
function was updated to check for both keyboard and mouse events.
Additional Changes
The series also includes a few other updates:
- Filled Boxes: The video API now supports drawing filled rectangles in addition to outlines.
- New Fonts: The Ubuntu Light and Bold fonts have been added.
- Testing: New tests for the mouse functionality have been added, including helpers to simulate clicks and verify the resulting actions.
This series expands U-Boot’s user interface capabilities by adding a new method for user input.