summary refs log tree commit diff stats
path: root/ui
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-01-17 15:40:58 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-13 23:48:35 +0400
commit6effaa16ac9846e7d6197ee54a0551fba61aecd7 (patch)
tree1c90910de7e28e600f1fb8203110f9b5831f426c /ui
parentde00b60db42dd88ce9aa7c77f5125a8a56308706 (diff)
downloadfocaccia-qemu-6effaa16ac9846e7d6197ee54a0551fba61aecd7.tar.gz
focaccia-qemu-6effaa16ac9846e7d6197ee54a0551fba61aecd7.zip
ui: set cursor position upon listener registration
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/console.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/console.c b/ui/console.c
index 35f8274aab..f3783021e5 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -95,6 +95,7 @@ struct QemuConsole {
     QemuUIInfo ui_info;
     QEMUTimer *ui_timer;
     QEMUCursor *cursor;
+    int cursor_x, cursor_y, cursor_on;
     const GraphicHwOps *hw_ops;
     void *hw;
 
@@ -1665,6 +1666,9 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
     if (con && con->cursor && dcl->ops->dpy_cursor_define) {
         dcl->ops->dpy_cursor_define(dcl, con->cursor);
     }
+    if (con && dcl->ops->dpy_mouse_set) {
+        dcl->ops->dpy_mouse_set(dcl, con->cursor_x, con->cursor_y, con->cursor_on);
+    }
     text_console_update_cursor(NULL);
 }
 
@@ -1909,6 +1913,9 @@ void dpy_mouse_set(QemuConsole *con, int x, int y, int on)
     DisplayState *s = con->ds;
     DisplayChangeListener *dcl;
 
+    con->cursor_x = x;
+    con->cursor_y = y;
+    con->cursor_on = on;
     if (!qemu_console_is_visible(con)) {
         return;
     }