aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-01-17 15:24:40 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-13 22:57:39 +0400
commit385ac97f8fad0e6980c5dfea71132d5ecfb16608 (patch)
tree2b9634e3b166674703a0a5e0493d01c0cc712dc5 /ui
parent2512a026fab8d526e623426a3002599a2de09d16 (diff)
ui: keep current cursor with QemuConsole
Keeping the current cursor around is useful, not only for VNC, but for other displays. Let's move it down, see the following patches for other usages. 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.c8
-rw-r--r--ui/vnc.c7
-rw-r--r--ui/vnc.h1
3 files changed, 10 insertions, 6 deletions
diff --git a/ui/console.c b/ui/console.c
index 98b701f5a3..0dccbdd4be 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -94,6 +94,7 @@ struct QemuConsole {
uint32_t head;
QemuUIInfo ui_info;
QEMUTimer *ui_timer;
+ QEMUCursor *cursor;
const GraphicHwOps *hw_ops;
void *hw;
@@ -1923,6 +1924,8 @@ void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor)
DisplayState *s = con->ds;
DisplayChangeListener *dcl;
+ cursor_unref(con->cursor);
+ con->cursor = cursor_ref(cursor);
if (!qemu_console_is_visible(con)) {
return;
}
@@ -2288,6 +2291,11 @@ QemuConsole *qemu_console_lookup_unused(void)
return NULL;
}
+QEMUCursor *qemu_console_get_cursor(QemuConsole *con)
+{
+ return con->cursor;
+}
+
bool qemu_console_is_visible(QemuConsole *con)
{
return (con == active_console) || (con->dcls > 0);
diff --git a/ui/vnc.c b/ui/vnc.c
index 8aec5d751e..bbd8b6baae 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -988,10 +988,10 @@ static void vnc_mouse_set(DisplayChangeListener *dcl,
static int vnc_cursor_define(VncState *vs)
{
- QEMUCursor *c = vs->vd->cursor;
+ QEMUCursor *c = qemu_console_get_cursor(vs->vd->dcl.con);
int isize;
- if (!vs->vd->cursor) {
+ if (!c) {
return -1;
}
@@ -1029,10 +1029,7 @@ static void vnc_dpy_cursor_define(DisplayChangeListener *dcl,
VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
VncState *vs;
- cursor_unref(vd->cursor);
g_free(vd->cursor_mask);
-
- vd->cursor = cursor_ref(vd->cursor);
vd->cursor_msize = cursor_get_mono_bpl(c) * c->height;
vd->cursor_mask = g_malloc0(vd->cursor_msize);
cursor_get_mono_mask(c, 0, vd->cursor_mask);
diff --git a/ui/vnc.h b/ui/vnc.h
index a60fb13115..757fa83044 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -159,7 +159,6 @@ struct VncDisplay
QKbdState *kbd;
QemuMutex mutex;
- QEMUCursor *cursor;
int cursor_msize;
uint8_t *cursor_mask;