@samitouri / QOSamiQemu / commits / 23ffb0abfa

ui/console: fire console ADDED/REMOVED notifications

Fire CONSOLE_ADDED at the end of graphic_console_init() and CONSOLE_REMOVED at the start of graphic_console_close(), so display backends can react to console hotplug/unplug events. REMOVED fires before the device link is cleared and before the placeholder surface swap, so handlers can unregister their DCL while the console is still in a known state. Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260623-b4-ui-v4-24-4656aec3398d@redhat.com>

Marc-André Lureau committed Jun 23, 2026 at 11:44 UTC 23ffb0abfadaf87744da091be4cf2abad9ce07e6
1 file changed +2
ui/console.c
+2
@@ -1142,6 +1142,7 @@ QemuConsole *qemu_graphic_console_create(DeviceState *dev, uint32_t head,
1142
1143 surface = qemu_create_placeholder_surface(width, height, noinit);
1144 qemu_console_set_surface(s, surface);
1145 + qemu_console_notify(QEMU_CONSOLE_ADDED, s);
1146 return s;
1147 }
1148
@@ -1158,6 +1159,7 @@ void qemu_graphic_console_close(QemuConsole *con)
1159 int height = qemu_console_get_height(con, 480);
1160
1161 trace_console_gfx_close(con->index);
1162 + qemu_console_notify(QEMU_CONSOLE_REMOVED, con);
1163 object_property_set_link(OBJECT(con), "device", NULL, &error_abort);
1164 qemu_graphic_console_set_hwops(con, &unused_ops, NULL);
1165 timer_del(con->ui_timer);