mouse: Add support for scaling of video-device coordinates
Add a mouse_set_video() function to set up the video device associated with the mouse. This allows mouse drivers to scale coordinates to match the display resolution. The video device information is stored in mouse_uc_priv rather than being driver-specific, providing a common place for all mouse drivers to access display dimensions for coordinate scaling. Update expo_set_mouse_enable() to call mouse_set_video() to configure the mouse with the display device. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <dm.h>
|
||||
#include <errno.h>
|
||||
#include <mouse.h>
|
||||
#include <video.h>
|
||||
|
||||
int mouse_get_event(struct udevice *dev, struct mouse_event *evt)
|
||||
{
|
||||
@@ -93,6 +94,22 @@ int mouse_set_ptr_visible(struct udevice *dev, bool visible)
|
||||
return ops->set_ptr_visible(dev, visible);
|
||||
}
|
||||
|
||||
int mouse_set_video(struct udevice *dev, struct udevice *video_dev)
|
||||
{
|
||||
struct mouse_uc_priv *uc_priv = dev_get_uclass_priv(dev);
|
||||
|
||||
uc_priv->video_dev = video_dev;
|
||||
if (video_dev) {
|
||||
uc_priv->video_width = video_get_xsize(video_dev);
|
||||
uc_priv->video_height = video_get_ysize(video_dev);
|
||||
} else {
|
||||
uc_priv->video_width = 0;
|
||||
uc_priv->video_height = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
UCLASS_DRIVER(mouse) = {
|
||||
.id = UCLASS_MOUSE,
|
||||
.name = "mouse",
|
||||
|
||||
Reference in New Issue
Block a user