[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/52] ui/vc: drop have_text
From: |
marcandre . lureau |
Subject: |
[PULL 05/52] ui/vc: drop have_text |
Date: |
Mon, 4 Sep 2023 15:52:02 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
If there are no "text" listener, the callback will simply be ignored.
The rest of text handling can be done cheaply.
This allows to remove some dependency on DisplayState from VC
implementation.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230830093843.3531473-6-marcandre.lureau@redhat.com>
---
ui/console.c | 42 +++++++++++++-----------------------------
1 file changed, 13 insertions(+), 29 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index a448e4d283..bec2d1a40a 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -133,7 +133,6 @@ struct DisplayState {
uint64_t update_interval;
bool refreshing;
bool have_gfx;
- bool have_text;
QLIST_HEAD(, DisplayChangeListener) listeners;
};
@@ -185,7 +184,6 @@ static void gui_setup_refresh(DisplayState *ds)
DisplayChangeListener *dcl;
bool need_timer = false;
bool have_gfx = false;
- bool have_text = false;
QLIST_FOREACH(dcl, &ds->listeners, next) {
if (dcl->ops->dpy_refresh != NULL) {
@@ -194,9 +192,6 @@ static void gui_setup_refresh(DisplayState *ds)
if (dcl->ops->dpy_gfx_update != NULL) {
have_gfx = true;
}
- if (dcl->ops->dpy_text_update != NULL) {
- have_text = true;
- }
}
if (need_timer && ds->gui_timer == NULL) {
@@ -209,7 +204,6 @@ static void gui_setup_refresh(DisplayState *ds)
}
ds->have_gfx = have_gfx;
- ds->have_text = have_text;
}
void graphic_hw_update_done(QemuConsole *con)
@@ -456,9 +450,7 @@ static void update_xy(QemuConsole *s, int x, int y)
TextCell *c;
int y1, y2;
- if (s->ds->have_text) {
- text_update_xy(s, x, y);
- }
+ text_update_xy(s, x, y);
y1 = (s->y_base + y) % s->total_height;
y2 = y1 - s->y_displayed;
@@ -482,9 +474,7 @@ static void console_show_cursor(QemuConsole *s, int show)
int y, y1;
int x = s->x;
- if (s->ds->have_text) {
- s->cursor_invalidate = 1;
- }
+ s->cursor_invalidate = 1;
if (x >= s->width) {
x = s->width - 1;
@@ -513,13 +503,11 @@ static void console_refresh(QemuConsole *s)
TextCell *c;
int x, y, y1;
- if (s->ds->have_text) {
- s->text_x[0] = 0;
- s->text_y[0] = 0;
- s->text_x[1] = s->width - 1;
- s->text_y[1] = s->height - 1;
- s->cursor_invalidate = 1;
- }
+ s->text_x[0] = 0;
+ s->text_y[0] = 0;
+ s->text_x[1] = s->width - 1;
+ s->text_y[1] = s->height - 1;
+ s->cursor_invalidate = 1;
vga_fill_rect(s, 0, 0, surface_width(surface), surface_height(surface),
color_table_rgb[0][QEMU_COLOR_BLACK]);
@@ -594,12 +582,10 @@ static void console_put_lf(QemuConsole *s)
c++;
}
if (s->y_displayed == s->y_base) {
- if (s->ds->have_text) {
- s->text_x[0] = 0;
- s->text_y[0] = 0;
- s->text_x[1] = s->width - 1;
- s->text_y[1] = s->height - 1;
- }
+ s->text_x[0] = 0;
+ s->text_y[0] = 0;
+ s->text_x[1] = s->width - 1;
+ s->text_y[1] = s->height - 1;
vga_bitblt(s, 0, FONT_HEIGHT, 0, 0,
s->width * FONT_WIDTH,
@@ -1069,9 +1055,7 @@ void console_select(unsigned int index)
displaychangelistener_display_console(dcl, s, NULL);
}
}
- if (ds->have_text) {
- dpy_text_resize(s, s->width, s->height);
- }
+ dpy_text_resize(s, s->width, s->height);
text_console_update_cursor(NULL);
}
}
@@ -1239,7 +1223,7 @@ static void text_console_invalidate(void *opaque)
{
QemuConsole *s = (QemuConsole *) opaque;
- if (s->ds->have_text && s->console_type == TEXT_CONSOLE) {
+ if (s->console_type == TEXT_CONSOLE) {
text_console_resize(s);
}
console_refresh(s);
--
2.41.0
- [PULL 00/52] UI patches, marcandre . lureau, 2023/09/04
- [PULL 01/52] ui: remove qemu_pixman_color() helper, marcandre . lureau, 2023/09/04
- [PULL 02/52] ui: remove qemu_pixman_linebuf_copy(), marcandre . lureau, 2023/09/04
- [PULL 03/52] ui/qmp: move screendump to ui-qmp-cmds.c, marcandre . lureau, 2023/09/04
- [PULL 04/52] ui/vc: replace vc_chr_write() with generic qemu_chr_write(), marcandre . lureau, 2023/09/04
- [PULL 05/52] ui/vc: drop have_text,
marcandre . lureau <=
- [PULL 06/52] ui/console: console_select() regardless of have_gfx, marcandre . lureau, 2023/09/04
- [PULL 07/52] ui/console: call dpy_gfx_update() regardless of have_gfx, marcandre . lureau, 2023/09/04
- [PULL 08/52] ui/console: drop have_gfx, marcandre . lureau, 2023/09/04
- [PULL 09/52] ui/console: get the DisplayState from new_console(), marcandre . lureau, 2023/09/04
- [PULL 10/52] ui/console: new_console() cannot fail, marcandre . lureau, 2023/09/04
- [PULL 11/52] ui/vc: VC always has a DisplayState now, marcandre . lureau, 2023/09/04
- [PULL 12/52] ui/vc: move VCChardev declaration at the top, marcandre . lureau, 2023/09/04
- [PULL 14/52] ui/vc: fold text_update_xy(), marcandre . lureau, 2023/09/04
- [PULL 13/52] ui/vc: replace variable with static text attributes default, marcandre . lureau, 2023/09/04
- [PULL 15/52] ui/vc: pass VCCharDev to VC-specific functions, marcandre . lureau, 2023/09/04