[Concept,06/14] sandbox: mouse: Implement set_ptr_visible()
Commit Message
From: Simon Glass <sjg@chromium.org>
Implement this new method using the SDL layer.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
arch/sandbox/cpu/sdl.c | 5 +++++
arch/sandbox/include/asm/sdl.h | 11 +++++++++++
drivers/input/sandbox_mouse.c | 8 ++++++++
3 files changed, 24 insertions(+)
@@ -646,3 +646,8 @@ int sandbox_sdl_sound_stop(void)
return 0;
}
+
+void sandbox_sdl_set_cursor_visible(bool visible)
+{
+ SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE);
+}
@@ -119,6 +119,13 @@ int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp);
*/
int sandbox_sdl_get_mouse_event(struct mouse_event *evt);
+/**
+ * sandbox_sdl_set_cursor_visible() - Show or hide the SDL cursor
+ *
+ * @visible: true to show the cursor, false to hide it
+ */
+void sandbox_sdl_set_cursor_visible(bool visible);
+
#else
static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp,
bool double_size)
@@ -178,6 +185,10 @@ static inline int sandbox_sdl_get_mouse_event(struct mouse_event *evt)
return -ENODEV;
}
+static inline void sandbox_sdl_set_cursor_visible(bool visible)
+{
+}
+
#endif
#endif
@@ -36,8 +36,16 @@ static int mouse_sandbox_get_event(struct udevice *dev,
return ret;
}
+static int mouse_sandbox_set_ptr_visible(struct udevice *dev, bool visible)
+{
+ sandbox_sdl_set_cursor_visible(visible);
+
+ return 0;
+}
+
const struct mouse_ops mouse_sandbox_ops = {
.get_event = mouse_sandbox_get_event,
+ .set_ptr_visible = mouse_sandbox_set_ptr_visible,
};
static const struct udevice_id mouse_sandbox_ids[] = {