]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Disconnect view from destroying output
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Wed, 24 Aug 2022 19:12:24 +0000 (21:12 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 24 Aug 2022 19:24:19 +0000 (20:24 +0100)
Fixes #497

Reported-by @Flrian

include/labwc.h
src/output.c
src/view.c

index deeaa5a9ffd31eb7c87cfec3812365b10363925d..490c7401f0d19e3b7c17151a546db2537ce9bf9d 100644 (file)
@@ -445,6 +445,7 @@ void view_update_app_id(struct view *view);
 void view_impl_map(struct view *view);
 void view_adjust_size(struct view *view, int *w, int *h);
 
+void view_on_output_destroy(struct view *view);
 void view_destroy(struct view *view);
 
 void foreign_toplevel_handle_create(struct view *view);
index 35da08905f12db262d4632da9f144e5242ed5c37..d441e7346ab9cee235e66fc37f494a5dd9caebb6 100644 (file)
@@ -46,6 +46,14 @@ output_destroy_notify(struct wl_listener *listener, void *data)
        wl_list_remove(&output->link);
        wl_list_remove(&output->frame.link);
        wl_list_remove(&output->destroy.link);
+
+       struct view *view;
+       struct server *server = output->server;
+       wl_list_for_each(view, &server->views, link) {
+               if (view->output == output) {
+                       view_on_output_destroy(view);
+               }
+       }
        free(output);
 }
 
index e50a18bf15d14b4ac5aa89cf088896df8dd3c694..a8c63b0e6cefd612fba1ec8c510d040496554a5a 100644 (file)
@@ -594,6 +594,13 @@ view_discover_output(struct view *view)
        }
 }
 
+void
+view_on_output_destroy(struct view *view)
+{
+       view_output_leave(view, view->output->wlr_output);
+       view->output = NULL;
+}
+
 void
 view_move_to_edge(struct view *view, const char *direction)
 {