mirror of https://github.com/xqemu/xqemu.git
console: update text terminal surface unconditionally
These days each QemuConsole has its own private DisplaySurface, so we can simply render updates all the time. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
521a580d23
commit
b35e3ba01a
31
ui/console.c
31
ui/console.c
|
@ -475,6 +475,9 @@ static inline void text_update_xy(QemuConsole *s, int x, int y)
|
||||||
|
|
||||||
static void invalidate_xy(QemuConsole *s, int x, int y)
|
static void invalidate_xy(QemuConsole *s, int x, int y)
|
||||||
{
|
{
|
||||||
|
if (!qemu_console_is_visible(s)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (s->update_x0 > x * FONT_WIDTH)
|
if (s->update_x0 > x * FONT_WIDTH)
|
||||||
s->update_x0 = x * FONT_WIDTH;
|
s->update_x0 = x * FONT_WIDTH;
|
||||||
if (s->update_y0 > y * FONT_HEIGHT)
|
if (s->update_y0 > y * FONT_HEIGHT)
|
||||||
|
@ -490,19 +493,15 @@ static void update_xy(QemuConsole *s, int x, int y)
|
||||||
TextCell *c;
|
TextCell *c;
|
||||||
int y1, y2;
|
int y1, y2;
|
||||||
|
|
||||||
if (!qemu_console_is_visible(s)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->ds->have_text) {
|
if (s->ds->have_text) {
|
||||||
text_update_xy(s, x, y);
|
text_update_xy(s, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->ds->have_gfx) {
|
|
||||||
y1 = (s->y_base + y) % s->total_height;
|
y1 = (s->y_base + y) % s->total_height;
|
||||||
y2 = y1 - s->y_displayed;
|
y2 = y1 - s->y_displayed;
|
||||||
if (y2 < 0)
|
if (y2 < 0) {
|
||||||
y2 += s->total_height;
|
y2 += s->total_height;
|
||||||
|
}
|
||||||
if (y2 < s->height) {
|
if (y2 < s->height) {
|
||||||
c = &s->cells[y1 * s->width + x];
|
c = &s->cells[y1 * s->width + x];
|
||||||
vga_putcharxy(s, x, y2, c->ch,
|
vga_putcharxy(s, x, y2, c->ch,
|
||||||
|
@ -510,7 +509,6 @@ static void update_xy(QemuConsole *s, int x, int y)
|
||||||
invalidate_xy(s, x, y2);
|
invalidate_xy(s, x, y2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void console_show_cursor(QemuConsole *s, int show)
|
static void console_show_cursor(QemuConsole *s, int show)
|
||||||
{
|
{
|
||||||
|
@ -518,22 +516,18 @@ static void console_show_cursor(QemuConsole *s, int show)
|
||||||
int y, y1;
|
int y, y1;
|
||||||
int x = s->x;
|
int x = s->x;
|
||||||
|
|
||||||
if (!qemu_console_is_visible(s)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->ds->have_text) {
|
if (s->ds->have_text) {
|
||||||
s->cursor_invalidate = 1;
|
s->cursor_invalidate = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->ds->have_gfx) {
|
|
||||||
if (x >= s->width) {
|
if (x >= s->width) {
|
||||||
x = s->width - 1;
|
x = s->width - 1;
|
||||||
}
|
}
|
||||||
y1 = (s->y_base + s->y) % s->total_height;
|
y1 = (s->y_base + s->y) % s->total_height;
|
||||||
y = y1 - s->y_displayed;
|
y = y1 - s->y_displayed;
|
||||||
if (y < 0)
|
if (y < 0) {
|
||||||
y += s->total_height;
|
y += s->total_height;
|
||||||
|
}
|
||||||
if (y < s->height) {
|
if (y < s->height) {
|
||||||
c = &s->cells[y1 * s->width + x];
|
c = &s->cells[y1 * s->width + x];
|
||||||
if (show && s->cursor_visible_phase) {
|
if (show && s->cursor_visible_phase) {
|
||||||
|
@ -546,7 +540,6 @@ static void console_show_cursor(QemuConsole *s, int show)
|
||||||
invalidate_xy(s, x, y);
|
invalidate_xy(s, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void console_refresh(QemuConsole *s)
|
static void console_refresh(QemuConsole *s)
|
||||||
{
|
{
|
||||||
|
@ -554,10 +547,6 @@ static void console_refresh(QemuConsole *s)
|
||||||
TextCell *c;
|
TextCell *c;
|
||||||
int x, y, y1;
|
int x, y, y1;
|
||||||
|
|
||||||
if (!qemu_console_is_visible(s)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->ds->have_text) {
|
if (s->ds->have_text) {
|
||||||
s->text_x[0] = 0;
|
s->text_x[0] = 0;
|
||||||
s->text_y[0] = 0;
|
s->text_y[0] = 0;
|
||||||
|
@ -566,7 +555,6 @@ static void console_refresh(QemuConsole *s)
|
||||||
s->cursor_invalidate = 1;
|
s->cursor_invalidate = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->ds->have_gfx) {
|
|
||||||
vga_fill_rect(s, 0, 0, surface_width(surface), surface_height(surface),
|
vga_fill_rect(s, 0, 0, surface_width(surface), surface_height(surface),
|
||||||
color_table_rgb[0][COLOR_BLACK]);
|
color_table_rgb[0][COLOR_BLACK]);
|
||||||
y1 = s->y_displayed;
|
y1 = s->y_displayed;
|
||||||
|
@ -585,7 +573,6 @@ static void console_refresh(QemuConsole *s)
|
||||||
dpy_gfx_update(s, 0, 0,
|
dpy_gfx_update(s, 0, 0,
|
||||||
surface_width(surface), surface_height(surface));
|
surface_width(surface), surface_height(surface));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void console_scroll(QemuConsole *s, int ydelta)
|
static void console_scroll(QemuConsole *s, int ydelta)
|
||||||
{
|
{
|
||||||
|
@ -640,7 +627,7 @@ static void console_put_lf(QemuConsole *s)
|
||||||
c->t_attrib = s->t_attrib_default;
|
c->t_attrib = s->t_attrib_default;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
if (qemu_console_is_visible(s) && s->y_displayed == s->y_base) {
|
if (s->y_displayed == s->y_base) {
|
||||||
if (s->ds->have_text) {
|
if (s->ds->have_text) {
|
||||||
s->text_x[0] = 0;
|
s->text_x[0] = 0;
|
||||||
s->text_y[0] = 0;
|
s->text_y[0] = 0;
|
||||||
|
@ -648,7 +635,6 @@ static void console_put_lf(QemuConsole *s)
|
||||||
s->text_y[1] = s->height - 1;
|
s->text_y[1] = s->height - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->ds->have_gfx) {
|
|
||||||
vga_bitblt(s, 0, FONT_HEIGHT, 0, 0,
|
vga_bitblt(s, 0, FONT_HEIGHT, 0, 0,
|
||||||
s->width * FONT_WIDTH,
|
s->width * FONT_WIDTH,
|
||||||
(s->height - 1) * FONT_HEIGHT);
|
(s->height - 1) * FONT_HEIGHT);
|
||||||
|
@ -662,7 +648,6 @@ static void console_put_lf(QemuConsole *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Set console attributes depending on the current escape codes.
|
/* Set console attributes depending on the current escape codes.
|
||||||
* NOTE: I know this code is not very efficient (checking every color for it
|
* NOTE: I know this code is not very efficient (checking every color for it
|
||||||
|
|
Loading…
Reference in New Issue