[Concept,18/42] video: Provide state for the cursor

Message ID 20250919201507.4024144-19-sjg@u-boot.org
State New
Headers
Series video: Support a cursor more generally |

Commit Message

Simon Glass Sept. 19, 2025, 8:14 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

We need to keep track of various things with the cursor, so create a
separate struct within the console. Add some

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/video_console.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
  

Patch

diff --git a/include/video_console.h b/include/video_console.h
index 842ead8d6a1..ba34bb8e19f 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -23,6 +23,28 @@  enum {
 	VIDCONSOLE_CURSOR_WIDTH		= 2,
 };
 
+/**
+ * struct vidconsole_cursor - cursor state for a video console
+ *
+ * The cursor is set up and maintained by the vidconsole. It is a simple
+ * vertical bar of width VIDCONSOLE_CURSOR_WIDTH shown in the foreground colour.
+ *
+ * @visible:	cursor is currently visible
+ * @x:		cursor left X position in pixels
+ * @y:		cursor top Y position in pixels
+ * @height:	height of cursor in pixels
+ * @index:	cursor index within the CLI or field being edited
+ */
+struct vidconsole_cursor {
+	bool visible;
+
+	/* filled in by get_cursor_info(): */
+	uint x;
+	uint y;
+	uint height;
+	uint index;
+};
+
 /**
  * struct vidconsole_priv - uclass-private data about a console device
  *
@@ -55,6 +77,7 @@  enum {
  * @escape_buf:		Buffer to accumulate escape sequence
  * @utf8_buf:		Buffer to accumulate UTF-8 byte sequence
  * @quiet:		Suppress all output from stdio
+ * @curs:		Cursor state and management
  */
 struct vidconsole_priv {
 	struct stdio_dev sdev;
@@ -80,6 +103,7 @@  struct vidconsole_priv {
 	char escape_buf[32];
 	char utf8_buf[5];
 	bool quiet;
+	struct vidconsole_cursor curs;
 };
 
 /**