[Concept,08/16] mouse: Place mouse in the middle of the display

Message ID 20251014111301.1059317-9-sjg@chromium.org
State New
Headers
Series boot: Separate out the boot-menu style |

Commit Message

Simon Glass Oct. 14, 2025, 11:12 a.m. UTC
  When starting the expo, put the mouse in the middle of the display so it
is more visible to the user.

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

 drivers/input/mouse-uclass.c | 2 ++
 include/mouse.h              | 2 ++
 2 files changed, 4 insertions(+)
  

Patch

diff --git a/drivers/input/mouse-uclass.c b/drivers/input/mouse-uclass.c
index 16a391532ae..dea8babf5fe 100644
--- a/drivers/input/mouse-uclass.c
+++ b/drivers/input/mouse-uclass.c
@@ -97,6 +97,8 @@  int mouse_set_video(struct udevice *dev, struct udevice *video_dev)
 	if (video_dev) {
 		uc_priv->video_width = video_get_xsize(video_dev);
 		uc_priv->video_height = video_get_ysize(video_dev);
+		uc_priv->last_pos.x = uc_priv->video_width / 2;
+		uc_priv->last_pos.y = uc_priv->video_height / 2;
 	} else {
 		uc_priv->video_width = 0;
 		uc_priv->video_height = 0;
diff --git a/include/mouse.h b/include/mouse.h
index 1a3a93801e2..92609cfd0e0 100644
--- a/include/mouse.h
+++ b/include/mouse.h
@@ -168,6 +168,8 @@  int mouse_set_ptr_visible(struct udevice *dev, bool visible);
  * Sets up the video device in the mouse uclass private data so mouse drivers
  * can scale coordinates to match the display resolution.
  *
+ * This also places the mouse in the middle of the display
+ *
  * @dev: Mouse device
  * @video_dev: Video device
  * Returns: 0 if OK, -ve on error