Drop the bookkeeping, we can simply afford an empty "foreach".
Notice that dpy_gfx_update_texture() is now called even when there are
no listeners. This is more correct, as the texture is not fully
refreshed when a listener connects, so it may be outdated/garbaged.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/ui/console.h | 1 -
ui/console-priv.h | 1 -
ui/console.c | 29 -----------------------------
3 files changed, 31 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 737ceba3890..3189788fb5f 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -392,7 +392,6 @@ QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head);
QemuConsole *qemu_console_lookup_by_device_name(const char *device_id,
uint32_t head, Error **errp);
QEMUCursor *qemu_console_get_cursor(QemuConsole *con);
-bool qemu_console_is_visible(QemuConsole *con);
bool qemu_console_is_graphic(QemuConsole *con);
bool qemu_console_is_fixedsize(QemuConsole *con);
bool qemu_console_is_gl_blocked(QemuConsole *con);
diff --git a/ui/console-priv.h b/ui/console-priv.h
index f8855753e30..4f731b4f9ce 100644
--- a/ui/console-priv.h
+++ b/ui/console-priv.h
@@ -16,7 +16,6 @@ struct QemuConsole {
DisplayState *ds;
DisplaySurface *surface;
DisplayScanout scanout;
- int dcls;
DisplayGLCtx *gl;
int gl_block;
QEMUTimer *gl_unblock_timer;
diff --git a/ui/console.c b/ui/console.c
index a9132e09eac..baffdeb22b1 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -650,9 +650,6 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
dcl->ds = get_alloc_displaystate();
QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next);
gui_setup_refresh(dcl->ds);
- if (dcl->con) {
- dcl->con->dcls++;
- }
displaychangelistener_display_console(dcl, &error_fatal);
if (QEMU_IS_GRAPHIC_CONSOLE(dcl->con)) {
dcl_set_graphic_cursor(dcl, QEMU_GRAPHIC_CONSOLE(dcl->con));
@@ -680,9 +677,6 @@ void unregister_displaychangelistener(DisplayChangeListener *dcl)
if (!ds) {
return;
}
- if (dcl->con) {
- dcl->con->dcls--;
- }
QLIST_REMOVE(dcl, next);
dcl->ds = NULL;
gui_setup_refresh(ds);
@@ -747,9 +741,6 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h)
w = MIN(w, width - x);
h = MIN(h, height - y);
- if (!qemu_console_is_visible(con)) {
- return;
- }
dpy_gfx_update_texture(con, con->surface, x, y, w, h);
QLIST_FOREACH(dcl, &s->listeners, next) {
if (con != dcl->con) {
@@ -848,9 +839,6 @@ void dpy_text_cursor(QemuConsole *con, int x, int y)
DisplayState *s = con->ds;
DisplayChangeListener *dcl;
- if (!qemu_console_is_visible(con)) {
- return;
- }
QLIST_FOREACH(dcl, &s->listeners, next) {
if (con != dcl->con) {
continue;
@@ -866,9 +854,6 @@ void dpy_text_update(QemuConsole *con, int x, int y, int w, int h)
DisplayState *s = con->ds;
DisplayChangeListener *dcl;
- if (!qemu_console_is_visible(con)) {
- return;
- }
QLIST_FOREACH(dcl, &s->listeners, next) {
if (con != dcl->con) {
continue;
@@ -884,9 +869,6 @@ void dpy_text_resize(QemuConsole *con, int w, int h)
DisplayState *s = con->ds;
DisplayChangeListener *dcl;
- if (!qemu_console_is_visible(con)) {
- return;
- }
QLIST_FOREACH(dcl, &s->listeners, next) {
if (con != dcl->con) {
continue;
@@ -906,9 +888,6 @@ void dpy_mouse_set(QemuConsole *c, int x, int y, bool on)
con->cursor_x = x;
con->cursor_y = y;
con->cursor_on = on;
- if (!qemu_console_is_visible(c)) {
- return;
- }
QLIST_FOREACH(dcl, &s->listeners, next) {
if (c != dcl->con) {
continue;
@@ -927,9 +906,6 @@ void dpy_cursor_define(QemuConsole *c, QEMUCursor *cursor)
cursor_unref(con->cursor);
con->cursor = cursor_ref(cursor);
- if (!qemu_console_is_visible(c)) {
- return;
- }
QLIST_FOREACH(dcl, &s->listeners, next) {
if (c != dcl->con) {
continue;
@@ -1287,11 +1263,6 @@ QEMUCursor *qemu_console_get_cursor(QemuConsole *con)
return QEMU_IS_GRAPHIC_CONSOLE(con) ? QEMU_GRAPHIC_CONSOLE(con)->cursor : NULL;
}
-bool qemu_console_is_visible(QemuConsole *con)
-{
- return con->dcls > 0;
-}
-
bool qemu_console_is_graphic(QemuConsole *con)
{
return con && QEMU_IS_GRAPHIC_CONSOLE(con);
--
2.53.0