Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ui/vc: move text console invalidate in helper
This will allow to split the VC code in a separate unit more easily.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230830093843.3531473-43-marcandre.lureau@redhat.com>
  • Loading branch information
elmarco committed Sep 4, 2023
1 parent 893fe23 commit 322dae4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/ui/console.h
Expand Up @@ -521,6 +521,7 @@ void console_select(unsigned int index);
void qemu_console_resize(QemuConsole *con, int width, int height);
DisplaySurface *qemu_console_surface(QemuConsole *con);
void coroutine_fn qemu_console_co_wait_update(QemuConsole *con);
int qemu_invalidate_text_consoles(void);

/* console-gl.c */
#ifdef CONFIG_OPENGL
Expand Down
13 changes: 9 additions & 4 deletions ui/console.c
Expand Up @@ -2500,13 +2500,11 @@ static void vc_chr_set_echo(Chardev *chr, bool echo)
drv->console->echo = echo;
}

static void text_console_update_cursor(void *opaque)
int qemu_invalidate_text_consoles(void)
{
QemuConsole *s;
int count = 0;

cursor_visible_phase = !cursor_visible_phase;

QTAILQ_FOREACH(s, &consoles, next) {
if (qemu_console_is_graphic(s) ||
!qemu_console_is_visible(s)) {
Expand All @@ -2516,7 +2514,14 @@ static void text_console_update_cursor(void *opaque)
graphic_hw_invalidate(s);
}

if (count) {
return count;
}

static void text_console_update_cursor(void *opaque)
{
cursor_visible_phase = !cursor_visible_phase;

if (qemu_invalidate_text_consoles()) {
timer_mod(cursor_timer,
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + CONSOLE_CURSOR_PERIOD / 2);
}
Expand Down

0 comments on commit 322dae4

Please sign in to comment.