mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 01:44:34 +00:00
expo: Add some scene fields needed for text entry
Add the CLI state, a buffer to hold the old value of the text being edited and a place to save vidconsole entry context. These will be use by the textline object. Set an upper limit on the maximum number of characters in a textline object supported by expo, at least for now. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
94598d5b0a
commit
93f99b35ec
2 changed files with 24 additions and 0 deletions
10
boot/scene.c
10
boot/scene.c
|
@ -32,6 +32,14 @@ int scene_new(struct expo *exp, const char *name, uint id, struct scene **scnp)
|
||||||
return log_msg_ret("name", -ENOMEM);
|
return log_msg_ret("name", -ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abuf_init(&scn->buf);
|
||||||
|
if (!abuf_realloc(&scn->buf, EXPO_MAX_CHARS + 1)) {
|
||||||
|
free(scn->name);
|
||||||
|
free(scn);
|
||||||
|
return log_msg_ret("buf", -ENOMEM);
|
||||||
|
}
|
||||||
|
abuf_init(&scn->entry_save);
|
||||||
|
|
||||||
INIT_LIST_HEAD(&scn->obj_head);
|
INIT_LIST_HEAD(&scn->obj_head);
|
||||||
scn->id = resolve_id(exp, id);
|
scn->id = resolve_id(exp, id);
|
||||||
scn->expo = exp;
|
scn->expo = exp;
|
||||||
|
@ -57,6 +65,8 @@ void scene_destroy(struct scene *scn)
|
||||||
list_for_each_entry_safe(obj, next, &scn->obj_head, sibling)
|
list_for_each_entry_safe(obj, next, &scn->obj_head, sibling)
|
||||||
scene_obj_destroy(obj);
|
scene_obj_destroy(obj);
|
||||||
|
|
||||||
|
abuf_uninit(&scn->entry_save);
|
||||||
|
abuf_uninit(&scn->buf);
|
||||||
free(scn->name);
|
free(scn->name);
|
||||||
free(scn);
|
free(scn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,14 @@
|
||||||
#ifndef __EXPO_H
|
#ifndef __EXPO_H
|
||||||
#define __EXPO_H
|
#define __EXPO_H
|
||||||
|
|
||||||
|
#include <abuf.h>
|
||||||
#include <dm/ofnode_decl.h>
|
#include <dm/ofnode_decl.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
|
|
||||||
struct udevice;
|
struct udevice;
|
||||||
|
|
||||||
|
#include <cli.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enum expoact_type - types of actions reported by the expo
|
* enum expoact_type - types of actions reported by the expo
|
||||||
*
|
*
|
||||||
|
@ -121,6 +124,9 @@ struct expo_string {
|
||||||
* @id: ID number of the scene
|
* @id: ID number of the scene
|
||||||
* @title_id: String ID of title of the scene (allocated)
|
* @title_id: String ID of title of the scene (allocated)
|
||||||
* @highlight_id: ID of highlighted object, if any
|
* @highlight_id: ID of highlighted object, if any
|
||||||
|
* @cls: cread state to use for input
|
||||||
|
* @buf: Buffer for input
|
||||||
|
* @entry_save: Buffer to hold vidconsole text-entry information
|
||||||
* @sibling: Node to link this scene to its siblings
|
* @sibling: Node to link this scene to its siblings
|
||||||
* @obj_head: List of objects in the scene
|
* @obj_head: List of objects in the scene
|
||||||
*/
|
*/
|
||||||
|
@ -130,6 +136,9 @@ struct scene {
|
||||||
uint id;
|
uint id;
|
||||||
uint title_id;
|
uint title_id;
|
||||||
uint highlight_id;
|
uint highlight_id;
|
||||||
|
struct cli_line_state cls;
|
||||||
|
struct abuf buf;
|
||||||
|
struct abuf entry_save;
|
||||||
struct list_head sibling;
|
struct list_head sibling;
|
||||||
struct list_head obj_head;
|
struct list_head obj_head;
|
||||||
};
|
};
|
||||||
|
@ -180,6 +189,11 @@ enum scene_obj_flags_t {
|
||||||
SCENEOF_OPEN = 1 << 2,
|
SCENEOF_OPEN = 1 << 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
/* Maximum number of characters allowed in an line editor */
|
||||||
|
EXPO_MAX_CHARS = 250,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct scene_obj - information about an object in a scene
|
* struct scene_obj - information about an object in a scene
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue