From c38cb5f59c7c6405a5ef614b2b8dfba26a7a159a Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Sat, 19 Oct 2024 20:06:11 -0400 Subject: [PATCH] output: move a few calls from new_output_notify() ... to more specific/logical locations, to make it possible in future to *not* immediately auto-configure new outputs when connected. In particular: - Move regions_reconfigure_output() and session_lock_output_create() into add_output_to_layout(), which would be called also if the output is enabled later. - Move seat_output_layout_changed() to do_output_layout_change() so it is called for any layout change, not just adding new outputs. --- src/output.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/output.c b/src/output.c index 0eee6331..4386a1b9 100644 --- a/src/output.c +++ b/src/output.c @@ -277,6 +277,14 @@ add_output_to_layout(struct server *server, struct output *output) lab_cosmic_workspace_group_output_enter( server->workspaces.cosmic_group, output->wlr_output); + + /* (Re-)create regions from config */ + regions_reconfigure_output(output); + + /* Create lock surface if needed */ + if (server->session_lock_manager->locked) { + session_lock_output_create(server->session_lock_manager, output); + } } static void @@ -451,16 +459,8 @@ new_output_notify(struct wl_listener *listener, void *data) add_output_to_layout(server, output); - /* Create regions from config */ - regions_reconfigure_output(output); - - if (server->session_lock_manager->locked) { - session_lock_output_create(server->session_lock_manager, output); - } - server->pending_output_layout_change--; do_output_layout_change(server); - seat_output_layout_changed(&output->server->seat); } void @@ -765,6 +765,7 @@ do_output_layout_change(struct server *server) "wlr_output_manager_v1_set_configuration()"); } output_update_for_layout_change(server); + seat_output_layout_changed(&server->seat); } }