ext_workspace_unstable: send output_enter when wl_output is bound late (#1480)

This commit is contained in:
Max Verevkin 2023-02-03 21:48:08 +02:00 committed by GitHub
parent a0bc0e4998
commit 3e6601fa29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -405,6 +405,22 @@ static void group_send_output(struct wlr_ext_workspace_group_handle_v1 *group,
}
}
static void workspace_handle_output_bind(struct wl_listener *listener,
void *data) {
struct wlr_output_event_bind *evt = (wlr_output_event_bind *)data;
struct wlr_ext_workspace_group_handle_v1_output *output =
wl_container_of(listener, output, output_bind);
struct wl_client *client = wl_resource_get_client(evt->resource);
struct wl_resource *group_resource, *tmp;
wl_resource_for_each_safe(group_resource, tmp, &output->group_handle->resources) {
if (client == wl_resource_get_client(group_resource)) {
zext_workspace_group_handle_v1_send_output_enter(group_resource,
evt->resource);
}
}
}
static void workspace_handle_output_destroy(struct wl_listener *listener,
void *data) {
struct wlr_ext_workspace_group_handle_v1_output *output =
@ -432,6 +448,9 @@ void wlr_ext_workspace_group_handle_v1_output_enter(
group_output->group_handle = group;
wl_list_insert(&group->outputs, &group_output->link);
group_output->output_bind.notify = workspace_handle_output_bind;
wl_signal_add(&output->events.bind, &group_output->output_bind);
group_output->output_destroy.notify = workspace_handle_output_destroy;
wl_signal_add(&output->events.destroy, &group_output->output_destroy);

View file

@ -52,6 +52,7 @@ struct wlr_ext_workspace_group_handle_v1_create_workspace_event {
struct wlr_ext_workspace_group_handle_v1_output {
struct wl_list link; // wlr_ext_workspace_group_handle_v1::outputs
struct wl_listener output_bind;
struct wl_listener output_destroy;
struct wlr_output *output;