From 41c94c4d87f47afcf4b772f8c428a7b092eb34b8 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 20 Mar 2023 10:39:55 +0100 Subject: Wayland: attempt to improve registry_handle_global_remove() This function still needs to be tested on a true multi-display Unix box --- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 06248bf07..7f0d7f8cd 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -1101,16 +1101,18 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis static void registry_handle_global_remove(void *data, struct wl_registry *registry, uint32_t name) {//TODO to be tested - Fl_Wayland_Screen_Driver::output *output; + Fl_Wayland_Screen_Driver::output *output, *tmp; //fprintf(stderr, "registry_handle_global_remove data=%p id=%u\n", data, name); Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); - wl_list_for_each(output, &(scr_driver->outputs), link) { // all screens of the system + wl_list_for_each_safe(output, tmp, &(scr_driver->outputs), link) { // all screens of the system if (output->id == name) { // the screen being removed + again: Fl_X *xp = Fl_X::first; while (xp) { // all mapped windows struct wld_window *win = (struct wld_window*)xp->xid; if (win->output == output) { - win->output = NULL; + delete win->fl_win; + goto again; } xp = xp->next; } -- cgit v1.2.3