aboutsummaryrefslogtreecommitdiff
path: root/ui/console.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-08-30 13:38:00 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-09-04 13:53:03 +0400
commitb97a76d0355f8fc3856de9ebd4f6929b51ba26fb (patch)
tree6575e7eba5386166003bc587e2377cdda66a3825 /ui/console.c
parentcfde05d15bbad620f87592edc2882611acbacc53 (diff)
ui/vc: move cursor_timer initialization to QemuTextConsole class
The timer is only relevant when a text console exists. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230830093843.3531473-27-marcandre.lureau@redhat.com>
Diffstat (limited to 'ui/console.c')
-rw-r--r--ui/console.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/console.c b/ui/console.c
index 8c4a2c83fa..ffa68c3a22 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1399,6 +1399,10 @@ qemu_text_console_finalize(Object *obj)
static void
qemu_text_console_class_init(ObjectClass *oc, void *data)
{
+ if (!cursor_timer) {
+ cursor_timer = timer_new_ms(QEMU_CLOCK_REALTIME,
+ text_console_update_cursor, NULL);
+ }
}
static void
@@ -2144,8 +2148,6 @@ static DisplayState *get_alloc_displaystate(void)
{
if (!display_state) {
display_state = g_new0(DisplayState, 1);
- cursor_timer = timer_new_ms(QEMU_CLOCK_REALTIME,
- text_console_update_cursor, NULL);
}
return display_state;
}